Skip to Content
Hands-On ROS for Robotics Programming
book

Hands-On ROS for Robotics Programming

by Bernardo Ronquillo Japón
February 2020
Intermediate to advanced
432 pages
10h 50m
English
Packt Publishing
Content preview from Hands-On ROS for Robotics Programming

Environments

An environment is a scenario that models a problem (such as keeping a cart pole standing up) with a minimal interface that an agent can interact with. You can see the cart pole environment in action by running this snippet of code:

$ cd ~/catkin_ws/src/Chapter12_OpenAI_Gym/cart-pole$ conda activate gym(gym) $ python cart-pole_env.py

You should see the cart pole moving and rotating randomly, as shown in the following screenshot:

The content of the script is quite simple:

import gymenv = gym.make('CartPole-v0')env.reset()for _ in range(1000):    env.render()    env.step(env.action_space.sample())env.close()

After importing the gym module, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering ROS for Robotics Programming

Mastering ROS for Robotics Programming

Lentin Joseph
ROS Robotics By Example - Second Edition

ROS Robotics By Example - Second Edition

Lentin Joseph, Carol Fairchild, Dr. Thomas L. Harman

Publisher Resources

ISBN: 9781838551308Supplemental Content