ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

How to print values in SelfLocalizer.cpp in Nav2d

asked 2016-03-03 04:44:27 -0600

RosUser gravatar image

I'm trying to analyse the Algorithms in SelfLocalizer node which is Particle Filter, Beam range finder, and Field range finder model. I understand the theory behind it but I want to see what is coming out in some of the equations. I have tried to add std::cout << "TEST" << std::endl; , printf ("%s \n", "TEST"); and ROS_INFO("usage: add_two_ints_client X Y"); in the code, then make the project and then run one of the launch file. I can see a lot of messages and parameters are printet in Terminal, but not the the one that I was expecting. Can anyone help me with that, or how can I read the value of a specific equation ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-03-03 05:23:49 -0600

Akif gravatar image

updated 2016-03-03 06:06:48 -0600

To be able to print messages on terminal, in launch file you should add output="screen" to the relevant <node> tag.

Also you can view ROS_INFO messages on rqt_console.

In reply to OP's comment:

It should be like this:

<node name="SelfLocalizer" pkg="nav2d_localizer" type="localizer" output="screen">
  <remap from="scan" to="base_scan"/>
  <param name="min_particles" type="int" value="5000"/>
edit flag offensive delete link more


Thanks but it does not work if it should be like this in launch file: <node name="SelfLocalizer" pkg="nav2d_localizer" type="localizer"><remap from="scan" to="base_scan"/><param name="min_particles" type="int" value="5000"/>

RosUser gravatar image RosUser  ( 2016-03-03 06:02:57 -0600 )edit

Thank you very much, now I can se a lot of printouts :D

RosUser gravatar image RosUser  ( 2016-03-03 06:31:35 -0600 )edit

Glad it helped! :)

Akif gravatar image Akif  ( 2016-03-03 06:33:17 -0600 )edit

Thanks you so much for sharing!

zzzZuo gravatar image zzzZuo  ( 2016-05-13 00:40:02 -0600 )edit

You're welcome!

Akif gravatar image Akif  ( 2016-05-24 03:27:33 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-03-03 04:44:27 -0600

Seen: 120 times

Last updated: Mar 03 '16