ros-industrial / ros2_canopen

CANopen driver framework for ROS2
https://ros-industrial.github.io/ros2_canopen/manual/rolling/
125 stars 52 forks source link

Error in canopen_fake_slaves/include/canopen_fake_slaves /cia402_slave.hpp inside function "run_profile_velocity_mode" #285

Closed jmflpalera closed 2 months ago

jmflpalera commented 2 months ago

Describe the bug

There is an error inside function run_profile_velocity_mode in header file canopen_fake_slaves/include/canopen_fake_slaves /cia402_slave.hpp.

The line is the next:

std::this_thread::sleep_for( std::chrono::milliseconds(((int32_t)control_cycle_period_d * 1000)));

The purpose of this line is to sleep 10 ms but control_cycle_period_d is truncated to 0 so sleep is always 0.

Replace with

std::this_thread::sleep_for( std::chrono::milliseconds(((int32_t)(control_cycle_period_d * 1000.0))));