How to use the uavcan.load_dsdl 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 / tools / studio / cvra_studio / commands / param_tree.py View on Github external
def main(args):
    logging.basicConfig(level=max(logging.CRITICAL - (10 * args.verbose), 0))

    if args.dsdl is not None:
        uavcan.load_dsdl(args.dsdl)

    app = QApplication(sys.argv)
    app.setFont(QFont('Open Sans', pointSize=20))

    node = UavcanNode(interface=args.interface, node_id=args.id)
    param = ParameterWidget(node=node)
    param.show()

    node.spin()
    sys.exit(app.exec_())
github cvra / robot-software / tools / studio / cvra_studio / commands / publish.py View on Github external
def main(args):
    uavcan.load_dsdl(args.dsdl)

    app = QApplication(sys.argv)
    app.setFont(QFont('Open Sans', pointSize=20))

    node = UavcanNode(interface=args.interface, node_id=args.node_id)

    pub = SetpointPublisherWidget(node)
    pub.show()

    node.spin()
    sys.exit(app.exec_())
github cvra / robot-software / tools / config_loader.py View on Github external
def main():
    args = parse_args()

    with open(args.config) as file:
        config = yaml.load(file)

    config = config['actuator'][args.board]
    config = config_fill_missing(config)

    # start UAVCAN node
    uavcan.load_dsdl(args.dsdl)
    node = uavcan.make_node(args.port, node_id=127)

    # set up board discovery
    disc = NodeDiscovery(node, args.board)

    while disc.get_id() is None:
        node.spin(0.1)

    print('board "{}" has ID {}'.format(args.board, disc.get_id()))

    print('Load config...')
    config_send(node, config, disc.get_id())

    node.spin(0.1)
github cvra / robot-software / tools / studio / cvra_studio / commands / node_discovery.py View on Github external
def main(args):
    uavcan.load_dsdl(args.dsdl)

    node = UavcanNode(interface=args.interface, node_id=args.node_id)

    model = NodeStatusMonitor(node)
    viewer = NodeStatusViewer()
    controller = NodeStatusController(model, viewer)

    node.spin()
github cvra / robot-software / minesweepers / uavcan_bridge / src / position_publisher.py View on Github external
def main():
    if len(sys.argv) < 3:
        print("usage: position_publisher.py uavcan_dsdl_path can_interface")
        return

    dsdl_path, can_interface = sys.argv[1], sys.argv[2]

    rospy.init_node('position_publisher', disable_signals=True)
    uwb_position_pub = rospy.Publisher('uwb_position', Point, queue_size=1)

    node = uavcan.make_node(can_interface)
    uavcan.load_dsdl(dsdl_path)

    def uwb_position_cb(event):
        x, y = event.message.x, event.message.y

        br = tf2_ros.TransformBroadcaster()
        br.sendTransform(tf_from_position(x, y, 0))

        uwb_position_pub.publish(Point(x, y, 0))

    handle = node.add_handler(uavcan.thirdparty.cvra.uwb_beacon.TagPosition,
                              uwb_position_cb)

    try:
        try:
            node.spin()
        except uavcan.UAVCANException:
github cvra / robot-software / uwb-beacon-firmware / tools / read_range.py View on Github external
msg.anchor_addr, msg.range))
        if args.output:
            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 / minesweepers / seeker_alarm_display / src / seeker_alarm_display.py View on Github external
def main():
    args, _ = parse_args()

    node = uavcan.make_node(args.iface, node_id=args.uavcan_id)
    uavcan.load_dsdl(args.dsdl_path)

    rospy.init_node('mine_alarm_signal', disable_signals=True)

    app = LedSignalApplication(node, args.topic)

    try:
        node.spin()
    except KeyboardInterrupt:
        pass
github cvra / robot-software / minesweepers / seeker_mine_detector / nodes / detect.py View on Github external
def main(args):
    rospy.init_node('emi_mine_detector', disable_signals=True)

    node = uavcan.make_node(args.can_interface)
    uavcan.load_dsdl(args.uavcan_dsdl_path)

    detector = MetalMineDetector(node=node, detector_id=args.detector_can_id,
                                 uwb_to_detector_offset=args.uwb_to_detector_offset)
    detector.run()
github cvra / robot-software / can-io-firmware / read_inputs.py View on Github external
def main():
    args = parse_args()

    node = uavcan.make_node(args.port)
    uavcan.load_dsdl(DSDL_DIR)

    handle = node.add_handler(uavcan.thirdparty.cvra.io.DigitalInput,
                              digital_input_cb)

    node.spin()
github cvra / robot-software / tools / studio / cvra_studio / commands / plot2d.py View on Github external
def main(args):
    logging.basicConfig(level=max(logging.CRITICAL - (10 * args.verbose), 0))
    app = QtGui.QApplication(sys.argv)

    uavcan.load_dsdl(args.dsdl)
    node = UavcanNode(interface=args.interface, node_id=args.node_id)

    plot_controller = Controller(node, args.plot_frequency)

    node.spin()

    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()