ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

baowei lin's profile - activity

2015-09-09 20:18:40 -0500 received badge  Famous Question (source)
2015-09-09 19:34:45 -0500 answered a question how to get turtlebot pose

I fixed the problem by changing getNodeHandle() to getMTNodeHandle(), which means if you want to subscribe multiple topics, you need a multiple thread callback queue. Thank you Willson again.

2015-09-09 07:10:34 -0500 commented question how to get turtlebot pose

sorry, the "succeed" means that I've changed them to nav_msgs. I will check nodelets, thank you Willson.

2015-09-08 19:28:09 -0500 received badge  Notable Question (source)
2015-09-08 19:15:17 -0500 commented answer how to get turtlebot pose

Thank you Willson, but I failed based on your code. It seems that poseCallback could not be called. Do I need to configure anywhere else?

2015-09-08 08:42:49 -0500 received badge  Popular Question (source)
2015-09-08 03:35:05 -0500 asked a question how to get turtlebot pose

I would like to get turtlebot poses when it walking. The following codes are used, but there is no responds. I guess it was the problem of topic "/odom". could anybody give me some ideas to fix it? thanks.

virtual void onInit()
{
      ros::NodeHandle& nh = getNodeHandle();
      ros::NodeHandle& private_nh = getPrivateNodeHandle();           
      cmdpub_ = private_nh.advertise<geometry_msgs::Twist> ("cmd_vel", 1);
      sub_= nh.subscribe<PointCloud>("depth/points", 1, &TurtlebotFollower::cloudcb, this);
      ros::Subscriber sub  = nh.subscribe("/odom",10, &TurtlebotFollower::poseCallback,this);
}

void poseCallback(const geometry_msgs::TwistPtr& msg){
      std::cout << msg.linear.x << "\t" <<msg.linear.y<< "\t" << 0.0 << "\t" << std::endl;
}

I found that if I put above codes into the onInit() virtual function, it will be failed. But if I put it in an main() function, it will be succeed. What is the difference?