How to do it…

We will start our discussion by running the program4 and program5 nodes using the following command:

$ roslaunch chapter4_tutorials program4_5.launch
  1. To plot a message using rqt_plot

We must have information about the type and structure of the messages; we can use rosmg show <msg type> to get this.

  1.  Run the following command to get the plot for the message in the /temperature topic, which is of the Int32 type of scalar data:
$ rosrun rqt_plot rqt_plot /temperature/data
  1. Select the message topic by the menu from the rqt_plot GUI after starting rqt_plot:
$ rosrun rqt_plot rqt_plot

While the node is running and when rqt_plot is started, we will see a plot that changes over time with the incoming messages from the /temperature topic, as shown in the following screenshot:

rqt_plot scalar data

Similarly, for the /acceleration topic, we have a Vector3 message (rostopic type /acceleration), which has three fields that we can visualize in a single plot as follows:

$ rosrun rqt_plot rqt_plot /acceleration/x:y:z

Alternatively, we can also select the /acceleration messages fields from the GUI menu, after launching the rqt_plot tool. Hopefully, we will see a plot similar to the one in the following screenshot:

rqt_plot non-scalar data
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.13.201