write a tf listener
2015-07-03 19:06
1206 查看
写tf listener时遇到的问题:
参考网页:http://wiki.ros.org/tf/Tutorials/Writing%20a%20tf%20listener%20%28C%2B%2B%29
1.
How to publish the pose (position) of the robot after having the tf listener to "listener.lookupTransform("/map", "/base_link", ros::Time(0), transform);"?
解决方法:
use the standard ROS messages to represent pose info. You can use either geometry_msgs/Pose (http://docs.ros.org/jade/api/geometry_msgs/html/msg/Pose.html)or
geometry_msgs/PoseWithCovariance (http://docs.ros.org/indigo/api/geometry_msgs/html/msg/PoseWithCovariance.html : if you need to publish pose together with its covariance )
so if you have populated transform variable with a call to lookupTransform, you can for example store the pose (without covariance) as follows,
geometry_msgs::Pose pose;
pose.position.x = transform.getOrigin().x();
pose.position.y = transform.getOrigin().y();
pose.position.z = transform.getOrigin().z();
// these two are valid only if the robot is operating in 2D
double yaw = tf::getYaw( transform.getRotation() );
pose.orientation = tf::createQuaternionMsgFromYaw( yaw );
now you can publish the 2D pose as a geometry_msgs/Pose message
2. 运行写好的程序时,遇到错误:"map" passed to lookupTransform argument target_frame does not exist.
解决方法:
- 加上listener.waitForTransform(...)
- 加include的头文件:
#include <nav_msgs/Odometry.h>
#include <tf/transform_listener.h>
再重新编译,就可以通过:./<nodename> 得到publish:; destination_frame和orginal_frame的 tf的topic了。
3. 运行写好的launch file to run publish the tf. 错误:ERROR: cannot launch node of type [learning_tf/pioneer_tf_listener]: can't locate node [pioneer_tf_listener] in package [learning_tf]
解决方法:需要在当前路径下 source ~/catkin_ws/devel/setup.bash
参考网页:http://wiki.ros.org/tf/Tutorials/Writing%20a%20tf%20listener%20%28C%2B%2B%29
1.
How to publish the pose (position) of the robot after having the tf listener to "listener.lookupTransform("/map", "/base_link", ros::Time(0), transform);"?
解决方法:
use the standard ROS messages to represent pose info. You can use either geometry_msgs/Pose (http://docs.ros.org/jade/api/geometry_msgs/html/msg/Pose.html)or
geometry_msgs/PoseWithCovariance (http://docs.ros.org/indigo/api/geometry_msgs/html/msg/PoseWithCovariance.html : if you need to publish pose together with its covariance )
so if you have populated transform variable with a call to lookupTransform, you can for example store the pose (without covariance) as follows,
geometry_msgs::Pose pose;
pose.position.x = transform.getOrigin().x();
pose.position.y = transform.getOrigin().y();
pose.position.z = transform.getOrigin().z();
// these two are valid only if the robot is operating in 2D
double yaw = tf::getYaw( transform.getRotation() );
pose.orientation = tf::createQuaternionMsgFromYaw( yaw );
now you can publish the 2D pose as a geometry_msgs/Pose message
2. 运行写好的程序时,遇到错误:"map" passed to lookupTransform argument target_frame does not exist.
解决方法:
- 加上listener.waitForTransform(...)
try { listener.waitForTransform(destination_frame, original_frame, ros::Time(0), ros::Duration(10.0) ); listener.lookupTransform(destination_frame, original_frame, ros::Time(0), transform); } catch (tf::TransformException ex) { ROS_ERROR("%s",ex.what()); }
- 加include的头文件:
#include <nav_msgs/Odometry.h>
#include <tf/transform_listener.h>
再重新编译,就可以通过:./<nodename> 得到publish:; destination_frame和orginal_frame的 tf的topic了。
3. 运行写好的launch file to run publish the tf. 错误:ERROR: cannot launch node of type [learning_tf/pioneer_tf_listener]: can't locate node [pioneer_tf_listener] in package [learning_tf]
解决方法:需要在当前路径下 source ~/catkin_ws/devel/setup.bash
相关文章推荐
- Linux杀死进程的方法
- NYOJ 860 又见01背包
- 开通博客了,记录下。。。
- Python的os.walk()方法详细讲解
- 会计日历-自动生成脚本
- CruiseYoung提供的带有详细书签的电子书籍目录
- foundation-NSNumber
- 这样看美剧,才能真正学好英语口语
- NYOJ 768 移位密码
- nexus私服搭建
- Oracle中drop user和drop user cascade的区别
- Linux Shell脚本查看NUMA信息
- SharePoint 如何使自己的网页自动跳转
- Usage of the @ (at) sign in ASP.NET
- NYOJ 906 杨辉三角
- android apk的编译打包过程
- A. Two Substrings
- HBase源码学习 客户端scan过程
- SQL中Group By的使用
- 数据库事务(Database Transaction)