Hi, I am running a simulation with Morse. tryin to get data from the robot with a C++ program using ROS.
The simulation is simple: a Quadrotor publishes its pose on a topic, and receives a navigation waypoint. The Morse file is:
from morse.builder import *
bee = Quadrotor()
waypoint = RotorcraftWaypoint()
bee.append(waypoint)
waypoint.add_stream('ros')
#The Quadrototor is called bee
beePose = Pose()
bee.append(beePose)
beePose.add_stream('ros', topic='/bee/pose')
#Environment
env = Environment('land-1/trees')
In the C++ program, the chatterCallback(...) is never called, while it should print the position of the Quadrorotor:
#include "ros/ros.h"
#include "geometry_msgs/Pose.h"
#include <sstream>
void chatterCallback(const geometry_msgs::Pose& msg)
{
geometry_msgs::Point coord = msg.position;
ROS_INFO("Current position: (%g, %g, %g)", coord.x, coord.y, coord.z);
}
int main(int argc, char **argv)
{
ros::init(argc, argv, "plan_node");
/**
* NodeHandle is the main access point to communications with the ROS system.
*/
ros::NodeHandle n;
/**
* The advertise() function is how you tell ROS that you want to
* publish on a given topic name.
*/
ros::Publisher motion = n.advertise<geometry_msgs::Pose>("/bee/waypoint", 1000);
// subscribes to stream
ros::Subscriber sub = n.subscribe("/bee/pose", 1000, chatterCallback);
ros::spin();
return 0;
}
While calling roswtf, I get the following error:
================================================================================
Static checks summary:
Found 1 warning(s).
Warnings are things that may be just fine, but are sometimes at fault
WARNING ROS_HOSTNAME may be incorrect: ROS_HOSTNAME [localhost] resolves to [::1], which does not appear to be a local IP address ['127.0.0.1', 'a.b.c'].
================================================================================
Beginning tests of your ROS graph. These may take awhile...
analyzing graph...
... done analyzing graph
running graph rules...
... done running graph rules
Online checks summary:
Found 1 error(s).
ERROR The following nodes should be connected but aren't:
* /morse->/plan_node (/bee/pose)
The weird thing is that all the nodes are running on the same computer. No network connection problems... in theory.
Finally, I get the desired data when running on another terminal:
rostopic echo /bee/pose
Any advice?
Thanks
Originally posted by Ruthven on ROS Answers with karma: 26 on 2014-05-16
Post score: 0