rktl_autonomy.snake_interface

This provides an interface to the snake game created in the [ARC Tutorials](https://github.com/purdue-arc/arc_tutorials/tree/snake_dqn). This was largely to gain experience in training reinforcement learning agents and there isn’t much need for it anymore. It may be useful for testing new types of agents or onboarding new members.

License:

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

Module Contents

Classes

SnakeActions

Possible actions for deep learner.

SnakeInterface

ROS interface for the snake game.

class rktl_autonomy.snake_interface.SnakeActions

Bases: enum.IntEnum

Possible actions for deep learner.

FORWARD = 0
LEFT
RIGHT
SIZE
class rktl_autonomy.snake_interface.SnakeInterface(eval=False, launch_file=['rktl_autonomy', 'snake_train.launch'], launch_args=[], run_id=None)

Bases: rktl_autonomy.ROSInterface

ROS interface for the snake 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.

_pose_cb(pose_msg)

Callback for poses of each segment of snake.

_goal_cb(goal_msg)

Callback for location of goal.

_score_cb(score_msg)

Callback for score of game.

_alive_cb(alive_msg)

Callback for active state of snake.