ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Is this the write way? i cant find the mistake.Can anyone please help me , especially at this example?
ros::NodeHandle node_handle_; ros::Subscriber xyz_subscriber_;
xyz_subscriber_ = node_handle_.subscribe("ModelStates", 10, ModelStatecallback);
void ModelStatecallback(const gazebo_msgs::ModelStates::ConstPtr& msg) { double actual_value_x=msg.pose[0].position.x double actual_value_y=msg.pose[0].position.y double actual_value_z=msg.pose[0].position.z }
int main(int argc, char **argv) { ros::init(argc, argv, "positioncontrol");
ros::spin();
return 0; }
2 | No.2 Revision |
Is this the write way? i cant find the mistake.Can anyone please help me , especially at this example?
ros::NodeHandle node_handle_; ros::Subscriber xyz_subscriber_;
xyz_subscriber_ = node_handle_.subscribe("ModelStates", 10, ModelStatecallback);
void ModelStatecallback(const gazebo_msgs::ModelStates::ConstPtr& msg)
{
double actual_value_x=msg.pose[0].position.x
actual_value_x=msg.pose[0].position.x;
double actual_value_y=msg.pose[0].position.y
actual_value_y=msg.pose[0].position.y;
double actual_value_z=msg.pose[0].position.z
actual_value_z=msg.pose[0].position.z;
}
int main(int argc, char **argv) { ros::init(argc, argv, "positioncontrol");
ros::spin();
return 0; }