本文整理汇总了C++中tf::Stamped::setRotation方法的典型用法代码示例。如果您正苦于以下问题:C++ Stamped::setRotation方法的具体用法?C++ Stamped::setRotation怎么用?C++ Stamped::setRotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tf::Stamped
的用法示例。
在下文中一共展示了Stamped::setRotation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv) {
// init node
ros::init(argc, argv, "planner_simple");
ros::NodeHandle nh;
// set up subscribers, publishers and listeners
ros::Subscriber goal_sub = nh.subscribe("/goal", 1000, goalCallback);
ros::Subscriber map_sub = nh.subscribe("/map", 1000, mapCallback);
//ros::Subscriber obstacle_map_sub = nh.subscribe("/obstacle_map", 1000, mapCallback);
marker_pub = nh.advertise<visualization_msgs::Marker>( "visualization_marker", 0 );
map_pub = nh.advertise<assn2::NavGrid>( "nav_grid", 0 );
tf::TransformListener listener;
listener.waitForTransform("/map", "/base_link", ros::Time(), ros::Duration(1.5));
// set initial goal to be the robot's pose
try {
tf::StampedTransform map_base_link_transform; //lookup transform only works for this type
listener.lookupTransform("/map", "/base_link", ros::Time(0), map_base_link_transform);
goal_pose.setOrigin(map_base_link_transform.getOrigin());
goal_pose.setRotation(map_base_link_transform.getRotation());
} catch (tf::TransformException ex) {
ROS_ERROR("%s",ex.what());
}
ros::Rate rate(10);
while (ros::ok()) {
// populates the goal_pose and global_map if a new message has been published
ros::spinOnce();
double cost_map[MAP_CELLS];
getCostFn(cost_map);
visualizeHeatMap(cost_map,"intrinsic_cost_map");
double nav_fn[MAP_CELLS];
tf::StampedTransform robot_to_map_transform; // the pose of the robot in the map frame
tf_util::getTransform(listener,"/base_link","/map",robot_to_map_transform);
getNavFn(cost_map,robot_to_map_transform, nav_fn);
visualizeHeatMap(nav_fn,"nav_fn");
publishMap(nav_fn);
rate.sleep();
}
}