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

Jaco's profile - activity

2014-10-28 00:02:17 -0500 received badge  Famous Question (source)
2012-12-28 03:59:26 -0500 received badge  Notable Question (source)
2012-12-19 04:35:17 -0500 received badge  Popular Question (source)
2012-12-19 03:58:24 -0500 commented question impossible to register messages in a bag file

... moreover i can't see the usual messages count down on screen, as it happens when i play bag files one by one

2012-12-19 03:57:22 -0500 commented question impossible to register messages in a bag file

thanks for answer. code fortunately compiles, it was just a copy-paste error. anyway, your answer was helpful. it works. after that, i played two bag files by writing rosbag play subset.bag end.bag. the execution of first bag file should last 3.45 mins but it seems not to finish. do you know reason?

2012-12-19 01:56:01 -0500 asked a question impossible to register messages in a bag file

Hi all,
I wrote a c++ script to send messages to a certain topic:

#include "std_msgs/String.h"
#include "ros/ros.h"

int main(int argc, char **argv){
    ros::init(argc, argv,"end_bag");
    ros::NodeHandle n;

    ros::Publisher chatter_pub = n.advertise<std_msgs::string>("/end",1000);
    ros::Rate loop_rate(10);

    std_msgs::String msg;
    msg.data = "end of loop";
    chatter_pub.publish(msg);

    //ROS_INFO("Message sent: %s",msg.data.c_str());
    while(chatter_pub.getNumSubscribers()==0){
        ros::spinOnce();
    }
    //sleep(10);
    loop_rate.sleep();
    ROS_INFO("Message sent: %s",msg.data.c_str());
    return 0;
}

From a shell, I started recording messages sent to topic /end :

rosbag record -O end /end 

After sending of the messages, I analyzed bag file and I didn't find anything inside it. Do you have any idea why this happens? I tried also to substitute the while in the code with while(1) but no messages is received as well.

Thanks for support.