rktl_autonomy.cartpole_interface

Cartpole is a very simple environment included within OpenAI Gym. There is not much of a reason to use it, except for verifying the functionality of this library. Two different interfaces are provided, CartpoleInterface and CartpoleDirectInterface. The former uses the ROSInterface class and the latter directly owns the Gym environment. To verify the ROSInterface worked, it was confirmed that they both behave the same way.

License:

BSD 3-Clause License Copyright (c) 2023, Autonomous Robotics Club of Purdue (Purdue ARC) All rights reserved.

Module Contents

Classes

CartpoleActions

Possible actions for deep learner.

CartpoleInterface

ROS interface for the cartpole game.

class rktl_autonomy.cartpole_interface.CartpoleActions

Bases: enum.IntEnum

Possible actions for deep learner.

LEFT = 0
RIGHT
SIZE
class rktl_autonomy.cartpole_interface.CartpoleInterface(eval=False, launch_file=['rktl_autonomy', 'cartpole_train.launch'], launch_args=[], run_id=None)

Bases: rktl_autonomy.ROSInterface

ROS interface for the cartpole game.

property action_space

The Space object corresponding to valid actions.

property observation_space

The Space object corresponding to valid observations.

_reset_env()

Reset environment for a new training episode.

_reset_self()

Reset internally for a new episode.

_has_state()

Determine if the new state is ready.

_clear_state()

Clear state variables / flags in preparation for new ones.

_get_state()

Get state tuple (observation, reward, done, info).

_publish_action(action)

Publish an action to the ROS network.

_obs_cb(obs_msg)

Callback for observation of game.

_reward_cb(reward_msg)

Callback for reward of game.

_done_cb(done_msg)

Callback for if episode is done.