ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
This works:
# definition in header
std::vector<physics::JointPtr> joints;
ros::Publisher rosPub;
std::unique_ptr<ros::NodeHandle> rosNode;
# initialization
this->rosNode.reset(new ros::NodeHandle( node_name ));
this->rosPub = this->rosNode->advertise<std_msgs::Float32MultiArray>("/velocity",1);
# callback function
std_msgs::Float32MultiArray msg;
msg.data.push_back( this->joints[0]->GetVelocity(0) );
msg.data.push_back( this->joints[1]->GetVelocity(0) );
msg.data.push_back( this->joints[2]->GetVelocity(0) );
this->rosPub.publish(msg);