ros-industrial / robotiq

Robotiq packages (http://wiki.ros.org/robotiq)
BSD 2-Clause "Simplified" License
229 stars 378 forks source link

why is the frenquency 62.5Hz?Itn't be 100hz? #124

Closed jokermay closed 6 years ago

jokermay commented 6 years ago

I run the 'robotiq_force_torque_sensor/nodes/rq_sensor.cpp' node, and found that the frequency of the published topic '/robotiq_force_torque_sensor' is about 62.5hz, which is lower than the specified value 100hz. I do not know why. Anyone knows the reason?

The following is the results of the commond 'rostopic hz /robotiq_force_torque_sensor'.

average rate: 62.459 min: 0.002s max: 0.032s std dev: 0.00143s window: 44732 average rate: 62.459 min: 0.002s max: 0.032s std dev: 0.00143s window: 44795 average rate: 62.459 min: 0.002s max: 0.032s std dev: 0.00143s window: 44859 average rate: 62.459 min: 0.002s max: 0.032s std dev: 0.00143s window: 44921 average rate: 62.459 min: 0.002s max: 0.032s std dev: 0.00143s window: 44985 average rate: 62.459 min: 0.002s max: 0.032s std dev: 0.00143s window: 45048 average rate: 62.459 min: 0.002s max: 0.032s std dev: 0.00143s window: 45111 average rate: 62.459 min: 0.002s max: 0.032s std dev: 0.00143s window: 45173 average rate: 62.459 min: 0.002s max: 0.032s std dev: 0.00143s window: 45237 average rate: 62.459 min: 0.002s max: 0.032s std dev: 0.00143s window: 45299 ^Caverage rate: 62.459 min: 0.002s max: 0.032s std dev: 0.00143s window: 45358

jproberge commented 6 years ago

Hi @jokermay, do you still have this problem?

Yes, the frequency should indeed be 100Hz. Can you describe your setup? How is your FT sensor physically connected? Any errors in the terminal when you launch the node?

davidkh1 commented 6 years ago

I can probably explain the issue. The reason for a 62.5 Hz may be from using a USB interface to the sensor. FTDI chip introduces a delay of up to 16 ms (1000/16=62.5Hz) when reading from a USB port. This parameter is configurable. On my Linux machine:

# checking for the delay cat /sys/bus/usb-serial/devices/ttyUSB0/latency_timer 16

# changing the delay sudo -i echo 2 > /sys/bus/usb-serial/devices/ttyUSB0/latency_timer cat /sys/bus/usb-serial/devices/ttyUSB0/latency_timer 2 # logout sudo

The output rate is 100 Hz now.

rostopic hz /robotiq_force_torque_sensor subscribed to [/robotiq_force_torque_sensor] average rate: 100.016