Ask Your Question

Ruthven's profile - activity

2020-11-19 11:36:00 -0600 answered a question question about ros2 bag play

The option has been implemented in April 2020 (https://github.com/ros2/rosbag2/commit/12c0cc6d783970d2e7570cc5d25d2b4969

2015-10-05 12:02:59 -0600 commented answer subscriber's callback never called in c++, using morse

Looks like a compiler error. Have you tried re/installing Catkin?

2014-08-27 04:22:47 -0600 received badge  Famous Question (source)
2014-06-15 09:36:45 -0600 received badge  Notable Question (source)
2014-05-22 23:33:08 -0600 commented answer ImportError: No module named yaml

If you've yaml present in more than a folder, you've to figure out which is the version you've to use (related to the version of python), and then add that folder in the PYTHONPATH. At least is what I did to solve the problem.

2014-05-16 23:54:23 -0600 received badge  Popular Question (source)
2014-05-16 05:52:07 -0600 commented question subscriber's callback never called in c++, using morse

Finally I found the answer.

Looking at morse initialization, there was the following message:

[WARN] [WallTime: 1400249615.593493] Could not process inbound connection: topic types do not match: [geometry_msgs/Pose] vs. [geometry_msgs/PoseStamped]{'topic': '/bee/pose', 'tcp_nodelay': '0', 'md5sum': 'e45d45a5a1ce597b249e23fb30fc871f', 'type': 'geometry_msgs/Pose', 'callerid': '/plan_node'}

So I changed the callback method:

void chatterCallback(const geometry_msgs::PoseStamped& msg)
{
        geometry_msgs::Point coord = msg.pose.position;
        ROS_INFO("Current position: (%g, %g, %g)", coord.x, coord.y, coord.z);
}

and don't forget to include:

#include "geometry_msgs/PoseStamped.h"
2014-05-16 05:29:13 -0600 asked a question subscriber's callback never called in c++, using morse

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

2013-12-19 03:30:43 -0600 received badge  Supporter (source)
2013-12-19 01:05:59 -0600 received badge  Editor (source)
2013-12-19 01:05:12 -0600 answered a question rosinstall on ubuntu 11.04

I found an alternative solution. The problem here is that (Python3) yaml is called from a Python2.7 script, with evident incompatibilities.

I thus installed yaml in its Python2.7 version:

 python2.7 setup.py install --prefix=/opt/ros/electric

and then added the path where it has been installed in PYTHONPATH, which in my case was something like:

export PYTHONPATH=$PYTHONPATH:/opt/ros/electric/lib/python2.7/site-packages
2013-12-12 01:50:16 -0600 commented answer having problems to uninstall

in /opt/ros are left the directories: dependencies fuerte