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

Publisher/Subscriber Node for Nao [closed]

asked 2014-02-22 19:16:07 -0600

dnth gravatar image

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..

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Vincent Rabaud
close date 2014-08-01 06:19:03.090008

2 Answers

Sort by » oldest newest most voted
2

answered 2014-02-23 08:19:06 -0600

AbuIbra gravatar image

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

And to write a publisher/subscriber look here: http://wiki.ros.org/roscpp/Overview/P... This works for every robot.

edit flag offensive delete link more
0

answered 2014-03-10 22:56:26 -0600

dnth gravatar image

updated 2014-03-10 22:57:18 -0600

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;
}
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-02-22 19:16:07 -0600

Seen: 523 times

Last updated: Mar 10 '14