Go to the documentation of this file.00001 #include<tf/transform_broadcaster.h>
00002 #include<ros/ros.h>
00003 #include<dynamixel_msgs/JointState.h>
00004
00005
00006
00007
00008 using namespace std;
00009
00010
00011 float pos;
00012
00013
00014 void obtainValues(const dynamixel_msgs::JointState &msg)
00015 {
00016
00017 pos = msg.current_pos;
00018
00019
00020 static tf::TransformBroadcaster br;
00021 tf::Transform transform;
00022 transform.setOrigin( tf::Vector3(0.0, 0.0, 0.0) );
00023 tf::Quaternion q;
00024 q.setRPY(pos, 0, 0);
00025 transform.setRotation(q);
00026 br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "servo", "laser"));
00027 }
00028
00029
00030 int main(int argc, char **argv)
00031 {
00032
00033 ros::init(argc, argv, "tilt_transform");
00034 ros::NodeHandle nh;
00035
00036
00037 ros::Subscriber position_sub = nh.subscribe("/tilt_controller/state", 5, &obtainValues);
00038
00039
00040 ros::spin();
00041 }