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

jdorfsman's profile - activity

2017-11-19 10:48:41 -0500 received badge  Famous Question (source)
2016-10-18 08:41:43 -0500 received badge  Student (source)
2016-05-07 18:08:13 -0500 received badge  Notable Question (source)
2016-05-07 18:08:13 -0500 received badge  Famous Question (source)
2016-03-08 21:39:32 -0500 received badge  Popular Question (source)
2016-03-08 21:39:32 -0500 received badge  Famous Question (source)
2016-03-08 21:39:32 -0500 received badge  Notable Question (source)
2015-11-18 23:31:11 -0500 received badge  Famous Question (source)
2015-08-30 23:13:52 -0500 received badge  Notable Question (source)
2015-08-04 12:43:16 -0500 received badge  Popular Question (source)
2015-08-04 10:36:32 -0500 commented answer ROS message sent but not received

Thanks, I did that and that solved it.

2015-08-04 10:36:18 -0500 received badge  Supporter (source)
2015-08-04 10:36:16 -0500 received badge  Scholar (source)
2015-08-04 09:44:51 -0500 asked a question ROS message sent but not received

I'm using ROS in my project and I need to send one message from time to time. I have this function:

void RosNetwork::sendMessage(string msg, string channel) {
    _mtx.lock();
    ros::Publisher chatter_pub = _n.advertise<std_msgs::String>(channel.c_str(),10);
    ros::Rate loop_rate(10);
    std_msgs::String msgToSend;
    msgToSend.data = msg.c_str();
    chatter_pub.publish(msgToSend);
    loop_rate.sleep();
    cout << "Message Sent" << endl;
    _mtx.unlock();
}

And I have this in python:

def callbackFirst(data):
    #rospy.loginfo(rospy.get_caller_id() + "I heard %s", data.data)
    print("Received message from first filter")

def callbackSecond(data):
    #rospy.loginfo(rospy.get_caller_id() + "I heard %s", data.data)
    print("Received message from second filter")

def listener():
    rospy.Subscriber("FirstTaskFilter", String, callbackFirst)
    print("subscribed to FirstTaskFilter")
    rospy.Subscriber("SecondTaskFilter", String, callbackSecond)
    print("subscribed to SecondTaskFilter")
    rospy.spin()

The listener is a thread in python. I get to the function sendMessage (I see in the terminal "Message Sent" a lot of times) but I don't see that the python script receives the message.

Update: I tested the python callback with rostopic pub /FirstTaskFilter std_msgs/String "test" and this works perfectly.

Any thought?

2015-06-10 12:15:52 -0500 received badge  Popular Question (source)
2015-05-24 08:14:56 -0500 asked a question ImageTransport throws Segmentation Fault

I'm trying to receive an image from a ROS channel in a larger system. This is the function:

Mat* RosNetwork::getImage(string channel) {
_mtx.lock();
ros::NodeHandle nh;
cout << "get image 0" << endl;
image_transport::ImageTransport it(nh);
cout << "get image 1" << endl;
image_transport::Subscriber sub = it.subscribe(channel, 1,
        imageCallback);
cout << "get image 2" << endl;
while (!imageFound) {
    ros::spinOnce();
}
cout << "Image found" << endl;
_mtx.unlock();
return &image;
}

This is the callback function:

Mat image;
bool imageFound = false;
void imageCallback(const sensor_msgs::ImageConstPtr& msg) {
    try {
        image = cv_bridge::toCvShare(msg, "bgr8")->image;
        if (!image.empty()) {
            imageFound = true;
        }
    } catch (cv_bridge::Exception& e) {
        ROS_ERROR("Could not convert from '%s' to 'bgr8'.",
                msg->encoding.c_str());
    }
}

When I run the code I get an Segmentation Fault in the image_transport::ImageTransport it(nh); line. This is run by a THREAD (if it changes something..). Sometimes it runs a few times and then gets a segmentation fault, and sometimes at the first run it gets. Any thoughts?

2015-04-03 05:15:44 -0500 asked a question Can't find binary when building with Eclipse

Hi! I followed the instructions on how to work with Eclipse and I have successfully imported the project to eclipse and I have no errors. I also managed to build the project with no errors. But when I try to run it, I receive an error that no binary file was found and when I try to create a new run configuration, I don't see any binary in the 'search project' option. Any ideas?

2015-02-03 08:46:35 -0500 commented answer Use ROS libraries in a non-ROS project

Is there a manual to do this, I'm trying but not succeeding to create this shared library..

2015-02-03 07:50:53 -0500 commented answer Use ROS libraries in a non-ROS project

I will try this option, thanks!

2015-02-02 10:31:15 -0500 received badge  Notable Question (source)
2015-02-02 03:06:53 -0500 received badge  Popular Question (source)
2015-02-01 02:54:59 -0500 asked a question Use ROS libraries in a non-ROS project

I have been working on a large project which uses OpenCV and Boost libraries (not using ROS). Now my manager asked me to include ROS libraries into the project. The only use for ROS will be to send and receive messages within a single robot. I will need to receive an operation code and send a respond. I was wondering if there is a way to configure a ROS project with only a "talker" and "listener" and then somehow include these in my main project and use them there? This could be the best way, another option is to compile my whole project using ROS (add all the libraries and dependencies) but I have tried this many times and I get multiple errors. Another way I thought would be creating a class inside my project which will use the terminal read/write from/to a topic.. Is the first option possible? Thanks!