how can i plot pose link3 in rqt for RRRBOT ?
hi . i wrote a tflistener for RRRBOT and add node in launch file like this : <node pkg="rrrbotfiles" type="rrrbotfilestf_listener" name="listener" output="screen" /> how can i plot pose link3 in rqt ??
my rrrbotfilestf_listener :
#include <ros/ros.h>
#include <tf/transform_listener.h>
#include <sensor_msgs/JointState.h>
//generic C/C++ include
#include <string>
#include <sstream>
#include <ros/console.h>
int main(int argc, char** argv){
ros::init(argc, argv, "rrrbot_files_tf_listener");
ros::NodeHandle node;
sensor_msgs::JointState jointstate_msg;
jointstate_msg.header.stamp = ros::Time(0);
jointstate_msg.name.push_back("joint1");
jointstate_msg.name.push_back("joint2");
//reset the messages
// jointstate_msg.position.clear();
// jointstate_msg.velocity.clear();
// jointstate_msg.effort.clear();
jointstate_msg.position.push_back(1);
//jointstate_msg.position[0]=1;
jointstate_msg.position.push_back(0.5);
//jointstate_msg.position[1]=0.5;
ros::Publisher pub_datainfo_joints;
pub_datainfo_joints=node.advertise<sensor_msgs::JointState>(node.resolveName("/calibrated/joint_states"), 10);
tf::TransformListener listener;
ros::Rate rate(10.0);
while (node.ok()){
pub_datainfo_joints.publish(jointstate_msg);
tf::StampedTransform transform;
try {
//listener.waitForTransform("/second_link", "/base_link", ros::Time(0), ros::Duration(10.0) );
listener.lookupTransform("/link3", "/link1", ros::Time(0), transform);
ROS_INFO("Translation = %f,%f,%f", transform.getOrigin().x(),transform.getOrigin().y(),transform.getOrigin().z());
} catch (tf::TransformException ex) {
ROS_ERROR("%s",ex.what());
}
rate.sleep();
}
return 0;
};
Asked by zakizadeh on 2017-03-10 14:41:08 UTC
Answers
You can plot topics on rqt_plot
as long as they are published. You seem to have asked similar questions about plotting over and over. I suggest you go through the tutorial set, particularly Understanding ROS Topics.
In case you've been asking how to plot topics from code (i.e. not by manual operation on GUI), I don't know if there's a way to do that easily. Here's a previous question that hasn't been answered yet.
Asked by 130s on 2017-03-17 19:48:25 UTC
Comments
how publish topic pose ?
Asked by zakizadeh on 2017-04-07 04:15:33 UTC
Comments