In this video we are going to see how to customize the axis of your plot, using the rqt_multiplot tool.
Step1. Create a project in Robot Ignite Academy(RIA)
We have the best online ROS course available in RIA. It helps you learn ROS in the easiest way without setting up ROS environment locally. The only thing you need is a browser! Create an account here and start to browse the trial course for free now! We’ll use the Using OpenAI with ROS unit 0 as an example today.
Step2. Plot with rqt_plot and rqt_multiplot
Let’s start by running the example
roslaunch cartpole_v0_training start_training.launch
You’ll see that the robot starts to move and learning to stand. The reward of each episode is publishing to the topic /openai/reward. You can see that with the following command
rostopic echo /openai/reward
It’s hard to tell the trend of the reward in the terminal. It will be nicer if we can plot it into a figure. We can use the rqt_plot tool to do it. You can run the following command to open rqt_plot.
rosrun rqt_plot rqt_plot
Then you have to open the graphical tool by click the monitor icon next to the simulation.
You can select the topic that you want to plot in rqt_plot. Let’s type openai/reward. The tool plot the reward for us, but it’s not updating.
With rqt_plot, the x-axis is always the timestamp. The problem is, in openai gym, the environment keeps resetting itself, so the reward value is overriding itself.
To solve this problem, we need another tool called rqt_multiplot.
rosrun rqt_multiplot rqt_multiplot
After opening it, click on the configure plot button(gear shape) and select the /openai/reward topic again. We select the episode number as our x-axis and the reward as our y-axis. Then hit enter.
Select the curve and click ok. Then click the play button. You should see it’s plotting. The rewards over episodes plot show the training progress much better in this case!
Want to learn more?
If you are interested in this topic, you can check our Using OpenAI with ROS Online Course.
Edit by: Tony Huang
RELATED LINKS
▸ ROS Development Studio (RDS)
▸ Robot Ignite Academy
▸ Using OpenAI with ROS Online Course
Feedback
Did you like this video? Do you have questions about what is explained? Whatever the case, please leave a comment on the comments section below, so we can interact and learn from each other.
If you want to learn about other ROS topics, please let us know on the comments area and we will do a video about it.
0 Comments