I am trying to stop the robot and this the code I have written in my program
> ros::Publisher pub1 =
> nh_->advertise> ("/move_base/cancel", 1000);
>> actionlib_msgs::GoalID msg;
>> msg.id = "";
>> ros::spinOnce();
>> pub1.publish(msg);
But, the robot continues to move and I even checked by listening to the topic using the below command but found no response.
> rostopic echo /move_base/cancel
However, when I try to publish to the topic, directly from terminal, it works.
> rostopic pub /move_base/cancel actionlib_msgs/GoalID -- {}
and also listening to the topic
> rostopic echo
> /move_base/cancel
gives the below message
> stamp: secs: 0 nsecs: 0
> id: ''
Any idea why this might happen?
Node handle declaration:
> class Door {
> public:
> Door(ros::NodeHandle* nh);
> protected:
> ros::NodeHandle *nh_;
> };
>> Door::Door( ros::NodeHandle* nh ) {
> nh_ = nh;
> }
> int main(int argc, char**argv) {
> ros::init(argc, argv,"robot_navigation");
>> ros::NodeHandle nh;
> ros::NodeHandle privateNode("~");
> Door door(&nh);
↧