How to use the uavcan.thirdparty function in uavcan

To help you get started, we’ve selected a few uavcan examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cvra / robot-software / uwb-beacon-firmware / tools / read_range.py View on Github external
output_file.writerow({
                'ts': msg.timestamp.usec,
                'range': msg.range,
                'anchor_addr': msg.anchor_addr
            })

            args.output.flush()

    node = uavcan.make_node(args.port, node_id=127)

    # TODO This path is a bit too hardcoded
    dsdl_path = os.path.join(
        os.path.dirname(__file__), '..', '..', 'uavcan_data_types', 'cvra', 'uwb_beacon')
    uavcan.load_dsdl(dsdl_path)

    node.add_handler(uavcan.thirdparty.uwb_beacon.RadioRange,
                     range_cb)

    node.spin()
github cvra / robot-software / tools / studio / cvra_studio / network / SetpointPublisher.py View on Github external
def __call__(self, node_id, value):
        return {
            'voltage': uavcan.thirdparty.cvra.motor.control.Voltage(node_id=node_id, voltage=value),
            'torque': uavcan.thirdparty.cvra.motor.control.Torque(node_id=node_id, torque=value),
            'velocity': uavcan.thirdparty.cvra.motor.control.Velocity(node_id=node_id, velocity=value),
            'position': uavcan.thirdparty.cvra.motor.control.Position(node_id=node_id, position=value),
        }[self.value]
github cvra / robot-software / minesweepers / seeker_mine_detector / nodes / emi_mine_detector.py View on Github external
def __init__(self, node, detector_id):
        self.node = node
        self.detector_id = detector_id
        self.node.add_handler(uavcan.thirdparty.cvra.metal_detector.EMIRawSignal, self._callback)
github cvra / robot-software / tools / config_loader.py View on Github external
def config_send(node, config, can_id):
    # create request
    req = uavcan.thirdparty.cvra.motor.config.LoadConfiguration.Request()

    # fill config message
    req.position_pid.kp = config['control']['position']['kp']
    req.position_pid.ki = config['control']['position']['ki']
    req.position_pid.kd = config['control']['position']['kd']
    req.position_pid.ilimit = config['control']['position']['ilimit']

    req.velocity_pid.kp = config['control']['velocity']['kp']
    req.velocity_pid.ki = config['control']['velocity']['ki']
    req.velocity_pid.kd = config['control']['velocity']['kd']
    req.velocity_pid.ilimit = config['control']['velocity']['ilimit']

    req.current_pid.kp = config['control']['current']['kp']
    req.current_pid.ki = config['control']['current']['ki']
    req.current_pid.kd = config['control']['current']['kd']
    req.current_pid.ilimit = config['control']['current']['ilimit']
github cvra / robot-software / tools / studio / node.py View on Github external
def publish_velocity():
        publish(uavcan.thirdparty.cvra.motor.feedback.VelocityPID(
            velocity_setpoint=step(scale=1, divider=1),
            velocity=random.uniform(0, 1)))
github cvra / robot-software / tools / studio / cvra_studio / commands / plot_uwb.py View on Github external
def __init__(self, node, size):
        self.node = node
        self.size = size
        self.node.add_handler(uavcan.thirdparty.cvra.uwb_beacon.TagPosition, self._callback)
        self.data = {
            'robot': { 'x': 0, 'y': 0, 'a': 0, 'r': 100, 'n': 6, 'fill': 'cvra' },
            'x_cursor': { 'pts': [[0, 0], [0, self.size[1]]], 'fill': 'cvra' },
            'y_cursor': { 'pts': [[0, 0], [self.size[0], 0]], 'fill': 'cvra' },
        }