Robotics StackExchange | Archived questions

Publisher/Subscriber Node for Nao

Is there any default template for me to write publisher/subscriber node for the nao? For example, what at the libraries that is needed and so forth..

Asked by dnth on 2014-02-22 20:16:07 UTC

Comments

Answers

See this: http://wiki.ros.org/Robots/Nao

And to write a publisher/subscriber look here: http://wiki.ros.org/roscpp/Overview/Publishers%20and%20Subscribers This works for every robot.

Asked by AbuIbra on 2014-02-23 09:19:06 UTC

Comments

I got it working by using this code. This is for subscribing to the foot bumpers. For subscribing to other sensors should be the same concept.

#include "ros/ros.h"
#include "nao_msgs/Bumper.h"

void bumperCallback(const nao_msgs::Bumper::ConstPtr &msg)
{
    ROS_INFO("I heard: %u and %u", msg->bumper, msg->state);
}

int main(int argc, char **argv)
{
    ros::init(argc, argv, "nao_bumper_listener");
    ros:: NodeHandle n;
    ros::Subscriber bump= n.subscribe("bumper", 1000, bumperCallback);
    ros::spin();
    return 0;
}

Asked by dnth on 2014-03-10 22:56:26 UTC

Comments