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

proprentnerl's profile - activity

2018-01-11 13:45:39 -0500 received badge  Famous Question (source)
2017-06-14 12:01:59 -0500 received badge  Notable Question (source)
2017-06-14 12:01:59 -0500 received badge  Popular Question (source)
2016-08-10 15:12:35 -0500 received badge  Student (source)
2015-12-07 02:35:14 -0500 received badge  Famous Question (source)
2015-08-06 06:11:45 -0500 asked a question Subscriber in a vector of objects

Hello,

I have a class module_diagnostics_processor which subscribes to a certain topic and publishes certain diagnostics messages for the diagnostic aggregator to visualize them in the rqt console. There are about 70 diagnostic topics so I am using std::vector to simplify the code and found an interesting problem. When I use:

//diag_messages is a vector of structs with the message defintions
std::vector<module_diagnostics_processor*> module_processors;
for(int i = 0; i < diag_messages.size(); i++){
    module_processors.push_back(new module_diagnostics_processor(diag_messages[i]));    
}

everything works as expected and all 70 diagnostic topics are published for the diagnostic aggregator but when I don't use pointers:

std::vector<module_diagnostics_processor> module_processors;
for(int i = 0; i < diag_messages.size(); i++){
    module_processors.push_back(module_diagnostics_processor(diag_messages[i]));    
}

only the last element of the vector module_processors has it's callbacks called and publishes anything, altough rqt_graph shows all topics subscribed from my node.

i would really like to know where this difference in behavior comes from, so any input would be greatly appreciated.

2015-03-13 04:38:39 -0500 received badge  Notable Question (source)
2015-03-13 04:38:39 -0500 received badge  Popular Question (source)
2014-07-23 17:56:19 -0500 received badge  Famous Question (source)
2014-07-23 06:34:12 -0500 answered a question ros::Time::now() always return wall time in c++

Problem solved.

use_sim_time was needed but lead to another problem. The main node was waiting for a service from a python node... when using use_sim_time the main node wouldn't detect the service as long as the /clock service was nit published... Our main node starts the simulation with the /clock service, so doing this first before waiting for the python node service fixed the problem... It seems that python nodes become unresponsive when use_sim_time is activated but no /clock topic is published even when they don't need ans ros::Time functions.

2014-07-22 17:13:53 -0500 received badge  Notable Question (source)
2014-07-22 15:10:16 -0500 received badge  Popular Question (source)
2014-07-22 11:25:13 -0500 commented answer ros::Time::now() always return wall time in c++

Yes use_sim_time is set before starting the node, it seems that my node starts before the /clock topic is available and than continues to use wall time instead of switching to simulation time. I will try waiting for the /clock topic before calling ros::Time::now() in my node.

2014-07-22 11:24:52 -0500 answered a question ros::Time::now() always return wall time in c++

Yes use_sim_time is set before starting the node, it seems thatmy node starts before the /clock topic is available and than continues to use wall time instead of switching to simulation time. I will try waiting for the /clock topic before calling ros::Time::now() in my node.

2014-07-22 11:21:44 -0500 received badge  Editor (source)
2014-07-22 09:20:18 -0500 edited question ros::Time::now() always return wall time in c++

Hey guys,

I have a very frustrating problem using Ros Hydro on ubuntu 12.04. I have a Gazebo Simulation posting telemetry data and I use this in a node to create a tf-tree for the simulation.

Now I tried to combine my tf-tree with some static transform publishers and noticed that my transform from the c++ node which subscribes to the telemetry is using wall time. The statics transform publishers are using simulation time.

I searched the web, set use_sim_time to true and tried some other things but ros::Time::now() in my c++ code always returns wall time, while the static transform publisher use simulation time! This makes it impossible to use the transform together.

use_sime_time is set before launching any nodes, but my node launches before the /clock topic is available, looking into this next.