:py:mod:`rktl_autonomy.snake_interface` ======================================= .. py:module:: rktl_autonomy.snake_interface .. autoapi-nested-parse:: 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 ~~~~~~~ .. autoapisummary:: rktl_autonomy.snake_interface.SnakeActions rktl_autonomy.snake_interface.SnakeInterface .. py:class:: SnakeActions Bases: :py:obj:`enum.IntEnum` Possible actions for deep learner. .. py:attribute:: FORWARD :value: 0 .. py:attribute:: LEFT .. py:attribute:: RIGHT .. py:attribute:: SIZE .. py:class:: SnakeInterface(eval=False, launch_file=['rktl_autonomy', 'snake_train.launch'], launch_args=[], run_id=None) Bases: :py:obj:`rktl_autonomy.ROSInterface` ROS interface for the snake game. .. py:property:: action_space The Space object corresponding to valid actions. .. py:property:: observation_space The Space object corresponding to valid observations. .. py:method:: _reset_env() Reset environment for a new training episode. .. py:method:: _reset_self() Reset internally for a new episode. .. py:method:: _has_state() Determine if the new state is ready. .. py:method:: _clear_state() Clear state variables / flags in preparation for new ones. .. py:method:: _get_state() Get state tuple (observation, reward, done, info). .. py:method:: _publish_action(action) Publish an action to the ROS network. .. py:method:: _pose_cb(pose_msg) Callback for poses of each segment of snake. .. py:method:: _goal_cb(goal_msg) Callback for location of goal. .. py:method:: _score_cb(score_msg) Callback for score of game. .. py:method:: _alive_cb(alive_msg) Callback for active state of snake.