How to use the odrive.protocol.PacketFromStreamConverter function in odrive

To help you get started, we’ve selected a few odrive 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 madcowswe / ODrive / tools / odrive / core.py View on Github external
def channel_from_serial_port(port, baud, packet_based, printer=noprint):
    """
    Inits an ODrive Protocol channel from a serial port name and baudrate.
    """
    if packet_based == True:
        # TODO: implement packet based transport over serial
        raise NotImplementedError("not supported yet")
    serial_device = odrive.serial_transport.SerialStreamTransport(port, baud)
    input_stream = odrive.protocol.PacketFromStreamConverter(serial_device)
    output_stream = odrive.protocol.PacketToStreamConverter(serial_device)
    return odrive.protocol.Channel(
            "serial port {}@{}".format(port, baud),
            input_stream, output_stream)