ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

According to the sources (here), cmd_vel_ is a pointer to a double that gets initialised in the ctor (here).

The code you show ("The problem occurs when I executed the following lines") doesn't initialise the PosVelJointHandle properly (or at least: it doesn't provide any values for the arguments), it's using this ctor.

Two comments:

  1. if you're writing a controller, why are you intantiating hardware_interface classes directly? Shouldn't that be the responsibility of your / a hardware_interface implementation for your robot?
  2. read up / find examples of how to initialise a PosVelJointHandle correctly and update your code (if you have determined you really should be intantiating those classes yourself.

According to the sources (here), cmd_vel_ is a pointer to a double that gets initialised in the ctor (here).

The code you show ("The problem occurs when I executed the following lines") doesn't initialise the PosVelJointHandle properly (or at least: it doesn't provide any values for the arguments), it's using this ctor., which sets all pointers to 0. If you then try to use setCommandVelocity(..), the assert is triggered.

Two comments:

  1. if you're writing a controller, why are you intantiating hardware_interface classes directly? Shouldn't that be the responsibility of your / a hardware_interface implementation for your robot?
  2. read up / find examples of how to initialise a PosVelJointHandle correctly and update your code (if you have determined you really should be intantiating those classes yourself.