|
bitsim
Model, simulate, estimate and control robots in C++
|
Differential drive robots that cross a circle to the opposite point, all at the same time, without driving into each other. More...
#include <multi_robot_navigation.h>


Public Types | |
| typedef MultiAgentEnvBase< std::vector< real_t >, std::array< real_t, 2 > > | base_type |
| typedef base_type::time_step_type | time_step_type |
| typedef base_type::joint_action_type | joint_action_type |
| Public Types inherited from bitrl::envs::multi_agent::MultiAgentEnvBase< std::vector< real_t >, std::array< real_t, 2 > > | |
| typedef std::vector< real_t > | observation_type |
| typedef std::array< real_t, 2 > | action_type |
| typedef MultiAgentTimeStep< std::vector< real_t > > | time_step_type |
| typedef std::vector< action_type > | joint_action_type |
| One action per agent, in the order of the agents. | |
Public Member Functions | |
| MultiRobotNavigation () | |
| void | make (const std::string &version, const std::unordered_map< std::string, std::any > &make_options, const std::unordered_map< std::string, std::any > &reset_options) override |
| Build the environment. | |
| time_step_type | reset (uint_t seed) override |
| Start a new episode with the given seed. | |
| time_step_type | step (const joint_action_type &actions) override |
| Apply one action per agent. | |
| uint_t | observation_size () const noexcept |
| The size of the observation of one robot. | |
| const std::vector< RobotPose > & | poses () const noexcept |
| const std::vector< std::array< real_t, 2 > > & | goals () const noexcept |
| const std::vector< std::array< real_t, 2 > > & | velocities () const noexcept |
| The velocity {vx, vy} of every robot in the last step. | |
| real_t | robot_radius () const noexcept |
| real_t | circle_radius () const noexcept |
| real_t | dt () const noexcept |
| real_t | max_v () const noexcept |
| real_t | max_w () const noexcept |
| real_t | distance_to_goal (uint_t robot) const |
| The distance of robot to its goal. | |
| uint_t | n_collisions () const noexcept |
| The moves cancelled by collisions in the current episode. | |
| real_t | min_separation () const noexcept |
| The smallest distance between the centres of two robots in the current episode. | |
| time_step_type | reset () |
| Start a new episode with the next seed. | |
| Public Member Functions inherited from bitrl::envs::multi_agent::MultiAgentEnvBase< std::vector< real_t >, std::array< real_t, 2 > > | |
| virtual | ~MultiAgentEnvBase ()=default |
| time_step_type | reset () |
| Start a new episode with the next seed. | |
| virtual void | close () |
| Release the environment; make() builds it again. | |
| uint_t | n_agents () const noexcept |
| const std::string & | agent_name (uint_t agent) const |
| The name of an agent, for printing. | |
| bool | is_created () const noexcept |
| std::string | env_name () const noexcept |
| std::string | version () const noexcept |
| uint_t | n_steps () const noexcept |
| The steps of the current episode so far. | |
| uint_t | max_steps () const noexcept |
| The steps after which an episode is truncated. | |
| uint_t | last_reset_seed () const noexcept |
| const std::unordered_map< std::string, std::any > & | make_options () const noexcept |
Additional Inherited Members | |
| Static Public Attributes inherited from bitrl::envs::multi_agent::MultiAgentEnvBase< std::vector< real_t >, std::array< real_t, 2 > > | |
| static constexpr uint_t | DEFAULT_ENV_SEED |
| Protected Member Functions inherited from bitrl::envs::multi_agent::MultiAgentEnvBase< std::vector< real_t >, std::array< real_t, 2 > > | |
| MultiAgentEnvBase (const std::string &name) | |
| void | set_agents_ (std::vector< std::string > names) |
| Name the agents; their number is the number of names. | |
| void | set_max_steps_ (uint_t max_steps) noexcept |
| void | make_created_ () noexcept |
| void | start_episode_ () noexcept |
| Start counting the steps of a new episode, for reset(). | |
| bool | count_step_ () noexcept |
| Count a step, for step(). | |
| void | check_step_ (const joint_action_type &actions) const |
| Throw unless make() was called and actions has one action per agent. | |
| T | option_ (const std::string &name, const T &default_value) const |
| Read a make option, or give default_value when it is missing. | |
Differential drive robots that cross a circle to the opposite point, all at the same time, without driving into each other.
The robots start evenly spaced on a circle, facing its centre, and each has to reach the point of the circle opposite its start, so that all of them meet in the middle. A robot moves with the kinematics of bitsim::dynamics::DiffDriveDynamics: its action is a linear and an angular velocity, {v, w}, clipped to max_v and max_w. The robots are discs of radius robot_radius; a move that would make two discs overlap is cancelled, the robot stands still for that step and the move counts as a collision. A robot within goal_tolerance of its goal is done and stops.
The observation of robot i, all in the world frame, is [x, y, theta, goal_x - x, goal_y - y, then for every other robot j in order: x_j - x, y_j - y, vx_j, vy_j], so 5 + 4 (n_robots - 1) numbers.
The reward of a robot that is not done is progress_weight times the distance it gained to its goal, plus time_reward, plus collision_reward on a collision and goal_reward when it arrives.
Make options, all optional: "n_robots" (uint_t, 4), "circle_radius" (real_t, 2.0), "robot_radius" (real_t, 0.15), "goal_tolerance" (real_t, 0.1), "dt" (real_t, 0.1), "max_v" (real_t, 0.5), "max_w" (real_t, 2.0), "progress_weight" (real_t, 1.0), "time_reward" (real_t, -0.01), "collision_reward" (real_t, -1.0), "goal_reward" (real_t, 10.0), "start_noise" (real_t, 0.0: the standard deviation of a random shift of the starts, drawn with the seed of the reset), "max_steps" (uint_t, 400).
| typedef MultiAgentEnvBase<std::vector<real_t>, std::array<real_t, 2> > bitrl::envs::multi_agent::MultiRobotNavigation::base_type |
| typedef base_type::joint_action_type bitrl::envs::multi_agent::MultiRobotNavigation::joint_action_type |
| bitrl::envs::multi_agent::MultiRobotNavigation::MultiRobotNavigation | ( | ) |
|
inlinenoexcept |
The distance of robot to its goal.
|
inlinenoexcept |
|
inlinenoexcept |
|
overridevirtual |
Build the environment.
| version | the version of the environment |
| make_options | the options of the environment; see the derived class |
| reset_options | the options of reset(), "seed" for one |
Reimplemented from bitrl::envs::multi_agent::MultiAgentEnvBase< std::vector< real_t >, std::array< real_t, 2 > >.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
The smallest distance between the centres of two robots in the current episode.
|
inlinenoexcept |
The moves cancelled by collisions in the current episode.
|
inlinenoexcept |
The size of the observation of one robot.
|
inlinenoexcept |
|
inline |
Start a new episode with the next seed.
|
overridevirtual |
Start a new episode with the given seed.
Implements bitrl::envs::multi_agent::MultiAgentEnvBase< std::vector< real_t >, std::array< real_t, 2 > >.
|
inlinenoexcept |
|
overridevirtual |
Apply one action per agent.
Implements bitrl::envs::multi_agent::MultiAgentEnvBase< std::vector< real_t >, std::array< real_t, 2 > >.
|
inlinenoexcept |
The velocity {vx, vy} of every robot in the last step.