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
std_msgs::Int32 targetIdx;

So targetIdx is declared to be of type std_msgs::Int32 here ..

targetIdx.data = targetIdx;

and here you assign the just instantiated msg to its own data member.

Could it be that you are shadowing your int targetIdx with the newly created std_msgs::Int32 targetIdx?

std_msgs::Int32 targetIdx;

So targetIdx is declared to be of type std_msgs::Int32 here ..

targetIdx.data = targetIdx;

.. and here you assign the just instantiated msg to its own data member.

That is not going to work.

Could it be that you are shadowing your int targetIdx with the newly created std_msgs::Int32 targetIdx?