Skip to content

[Proposal] Use a serial port with low latency mode on Linux #511

@ssr-yuki

Description

@ssr-yuki

Hi, thank you for maintaining.
Here I would like to propose an idea related to the following comments:

#define LATENCY_TIMER 16 // msec (USB latency timer)
// You should adjust the latency timer value. From the version Ubuntu 16.04.2, the default latency timer of the usb serial is '16 msec'.
// When you are going to use sync / bulk read, the latency timer should be loosen.
// the lower latency timer value, the faster communication speed.
// Note:
// You can check its value by:
// $ cat /sys/bus/usb-serial/devices/ttyUSB0/latency_timer
//
// If you think that the communication is too slow, type following after plugging the usb in to change the latency timer
//
// Method 1. Type following (you should do this everytime when the usb once was plugged out or the connection was dropped)
// $ echo 1 | sudo tee /sys/bus/usb-serial/devices/ttyUSB0/latency_timer
// $ cat /sys/bus/usb-serial/devices/ttyUSB0/latency_timer
//
// Method 2. If you want to set it as be done automatically, and don't want to do above everytime, make rules file in /etc/udev/rules.d/. For example,
// $ echo ACTION==\"add\", SUBSYSTEM==\"usb-serial\", DRIVER==\"ftdi_sio\", ATTR{latency_timer}=\"1\" > 99-dynamixelsdk-usb.rules
// $ sudo cp ./99-dynamixelsdk-usb.rules /etc/udev/rules.d/
// $ sudo udevadm control --reload-rules
// $ sudo udevadm trigger --action=add
// $ cat /sys/bus/usb-serial/devices/ttyUSB0/latency_timer
//
// or if you have another good idea that can be an alternatives,
// please give us advice via github issue https://github.com/ROBOTIS-GIT/DynamixelSDK/issues

We can set the latency timer to 1 ms from C/C++ codes.

Setting ASYNC_LOW_LATENCY flag to serial_struct struct used in here is equivalent to setting the device latency timer to 1 ms for device communication.

Once you agree with accelerating default communication speed of this SDK, I will implement it and send a PR soon.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions