Hi, how can i set the initial pose of the /turtle2
in tf_listener from this tutorial: http://wiki.ros.org/tf/Tutorials/Writing%20a%20tf%20listener%20%28C%2B%2B%29
i tried this:
ros::service::waitForService("spawn");
ros::ServiceClient add_turtle =
node.serviceClient<turtlesim::Spawn>("spawn");
turtlesim::Spawn srv;
srv.Request.x = 5; //added
srv.Request.y = 5; //added
add_turtle.call(srv);
but it shows up error when i try to compile
/home/chao/abc/src/learning_tf/src/turtle_tf_listener.cpp:15:7: error: invalid use of ‘turtlesim::Spawn::Request’
/home/chao/abc/src/learning_tf/src/turtle_tf_listener.cpp:16:7: error: invalid use of ‘turtlesim::Spawn::Request’
make[2]: *** [learning_tf/CMakeFiles/turtle_tf_listener.dir/src/turtle_tf_listener.cpp.o] Error 1
how can i set the initial pose for the /turtle1
as well? i suppose that the following (from tf_broadcaster
tutorial) has nothing to do with the initial pose, just to set the transform with respect to the /world
?
void poseCallback(const turtlesim::PoseConstPtr& msg){
static tf::TransformBroadcaster br;
tf::Transform transform;
transform.setOrigin( tf::Vector3(msg->x, msg->y, 0.0) );
transform.setRotation( tf::Quaternion(0, 0, msg->theta) );
br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "world", turtle_name));
}
Originally posted by chao on ROS Answers with karma: 153 on 2014-01-09
Post score: 1