ros-industrial / ros_canopen

CANopen driver framework for ROS (http://wiki.ros.org/ros_canopen)
GNU Lesser General Public License v3.0
332 stars 270 forks source link

[canopen_motor_node] variable initialization #414

Open vincentrou opened 3 years ago

vincentrou commented 3 years ago

The commands variables for velocity and effort in the HandleLayer class are not initialzed. https://github.com/ros-industrial/ros_canopen/blob/melodic-devel/canopen_motor_node/include/canopen_motor_node/handle_layer.h#L89

I think they should be initialized to zero to avoid bad init with non zero cmd.

mathias-luedtke commented 2 years ago

In this case the value should be managed by hardware_interface::JointHandle. And if the JointHandle is not active, it will be overwritten anyway.

Any fixed value for the commands (especially cmdpos) is wrong, but It is okay to set it to 0 to just make any static code analyzer happy :)