bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
mcts_line_following Namespace Reference

Classes

struct  Pose
class  TrackModel
struct  TowardsTheLine
struct  Candidate
class  World
class  Display
struct  Options
struct  MCTSConfig
 The configuration of MCTSSolver. More...
class  MCTSSolver
 Monte Carlo tree search, with UCB to pick the children (UCT). More...
class  CHRONO_DiffDriveRobot
 A differential-drive robot in Chrono: a chassis, two driven wheels and a ball caster. Each driven wheel has an actuators::DCMotor. More...
class  ContactCounter
 Counts the contacts that touch any of a set of bodies, such as the obstacles a robot should not hit. More...
class  FloorImage
 An image of the floor, centred on the world origin. More...
class  RoundedRectangle
 A closed track in the plane: a rectangle centred on the origin with its sides along x and y, and its corners rounded with quarter circles. More...
class  FrameRecorder
 Writes the window to dir/frame_00000.png, frame_00001.png, ..., rate times a second of simulation, to be put together into a movie. With an empty dir it writes nothing. More...
class  Trail
 A path drawn as a line: in the plane, just above the floor, where a robot has been or where it thinks it has been; or in space, where something has flown. More...

Typedefs

using Command = bitsim::control::DiffDriveCommand
using Point = std::array<real_t, 2>
using real_t
 real_t
using uint_t
 uint_t

Functions

real_t angle_around_track (real_t x, real_t y)
real_t distance_to_box (const Point &box, real_t x, real_t y)
real_t track_direction (real_t x, real_t y)
template<typename Solver>
std::vector< Candidate > candidates (const Solver &solver, const TrackModel &model)
FloorImage draw_floor ()
Options parse (int argc, char **argv)
int run (const Options &options)

Variables

const std::string WINDOW_TITLE = "Line following with Monte Carlo tree search"
const real_t PI = bitsim::consts::maths::PI
const real_t STEP_SIZE = 0.01
const real_t DECISION_PERIOD = 0.2
const real_t TIME_LIMIT = 150.0
const real_t PRINT_PERIOD = 2.0
const real_t RENDER_RATE = 30.0
const real_t RECORD_RATE = 10.0
const real_t FOLLOW_BEHIND = 2.6
const real_t FOLLOW_HEIGHT = 2.4
const real_t FOLLOW_AHEAD = 1.5
const real_t TRACK_HALF_LENGTH = 2.2
const real_t TRACK_HALF_WIDTH = 1.4
const real_t TRACK_CORNER_RADIUS = 0.7
const real_t LINE_WIDTH = 0.05
const real_t FLOOR_WIDTH = 5.6
const real_t FLOOR_HEIGHT = 4.6
const real_t METRES_PER_PIXEL = 0.005
const std::vector< Point > OBSTACLES {{0.0, -TRACK_HALF_WIDTH}, {-0.2, TRACK_HALF_WIDTH}}
const real_t OBSTACLE_SIZE = 0.3
const real_t OBSTACLE_HEIGHT = 0.4
const Point START {-1.3, -TRACK_HALF_WIDTH}
const RoundedRectangle TRACK (TRACK_HALF_LENGTH, TRACK_HALF_WIDTH, TRACK_CORNER_RADIUS)
const real_t CHASSIS_AHEAD = 0.1
const real_t ROBOT_RADIUS = 0.3
const real_t CLEARANCE = 0.05
const uint_t MODEL_SUBSTEPS = 4
const std::array< Command, 5 > COMMANDS
const real_t LINE_COST = 0.5
const real_t HIT_COST = 10.0
const real_t ROLLOUT_GAIN = 2.0
const real_t ROLLOUT_APPROACH = 2.0
const real_t ROLLOUT_RANDOM = 0.2
const real_t DETOUR_NEAR = 1.0
const real_t DETOUR_OFFSET = 0.6
const MCTSConfig SEARCH
const real_t METRES_PER_RADIAN = TRACK.perimeter() / (2.0 * PI)
const std::array< const char *, 5 > COMMAND_NAMES

Typedef Documentation

◆ Command

◆ Point

using mcts_line_following::Point = std::array<real_t, 2>

◆ real_t

◆ uint_t

Function Documentation

◆ angle_around_track()

real_t mcts_line_following::angle_around_track ( real_t x,
real_t y )

◆ candidates()

template<typename Solver>
std::vector< Candidate > mcts_line_following::candidates ( const Solver & solver,
const TrackModel & model )

◆ distance_to_box()

real_t mcts_line_following::distance_to_box ( const Point & box,
real_t x,
real_t y )

◆ draw_floor()

FloorImage mcts_line_following::draw_floor ( )

◆ parse()

Options mcts_line_following::parse ( int argc,
char ** argv )

◆ run()

int mcts_line_following::run ( const Options & options)

◆ track_direction()

real_t mcts_line_following::track_direction ( real_t x,
real_t y )

Variable Documentation

◆ CHASSIS_AHEAD

const real_t mcts_line_following::CHASSIS_AHEAD = 0.1

◆ CLEARANCE

const real_t mcts_line_following::CLEARANCE = 0.05

◆ COMMAND_NAMES

const std::array<const char *, 5> mcts_line_following::COMMAND_NAMES
Initial value:
{"straight", "left", "right", "hard left",
"hard right"}

◆ COMMANDS

const std::array<Command, 5> mcts_line_following::COMMANDS
Initial value:
{
{{0.3, 0.0}, {0.3, 0.8}, {0.3, -0.8}, {0.2, 1.6}, {0.2, -1.6}}}

◆ DECISION_PERIOD

const real_t mcts_line_following::DECISION_PERIOD = 0.2

◆ DETOUR_NEAR

const real_t mcts_line_following::DETOUR_NEAR = 1.0

◆ DETOUR_OFFSET

const real_t mcts_line_following::DETOUR_OFFSET = 0.6

◆ FLOOR_HEIGHT

const real_t mcts_line_following::FLOOR_HEIGHT = 4.6

◆ FLOOR_WIDTH

const real_t mcts_line_following::FLOOR_WIDTH = 5.6

◆ FOLLOW_AHEAD

const real_t mcts_line_following::FOLLOW_AHEAD = 1.5

◆ FOLLOW_BEHIND

const real_t mcts_line_following::FOLLOW_BEHIND = 2.6

◆ FOLLOW_HEIGHT

const real_t mcts_line_following::FOLLOW_HEIGHT = 2.4

◆ HIT_COST

const real_t mcts_line_following::HIT_COST = 10.0

◆ LINE_COST

const real_t mcts_line_following::LINE_COST = 0.5

◆ LINE_WIDTH

const real_t mcts_line_following::LINE_WIDTH = 0.05

◆ METRES_PER_PIXEL

const real_t mcts_line_following::METRES_PER_PIXEL = 0.005

◆ METRES_PER_RADIAN

const real_t mcts_line_following::METRES_PER_RADIAN = TRACK.perimeter() / (2.0 * PI)

◆ MODEL_SUBSTEPS

const uint_t mcts_line_following::MODEL_SUBSTEPS = 4

◆ OBSTACLE_HEIGHT

const real_t mcts_line_following::OBSTACLE_HEIGHT = 0.4

◆ OBSTACLE_SIZE

const real_t mcts_line_following::OBSTACLE_SIZE = 0.3

◆ OBSTACLES

const std::vector<Point> mcts_line_following::OBSTACLES {{0.0, -TRACK_HALF_WIDTH}, {-0.2, TRACK_HALF_WIDTH}}

◆ PI

const real_t mcts_line_following::PI = bitsim::consts::maths::PI

◆ PRINT_PERIOD

const real_t mcts_line_following::PRINT_PERIOD = 2.0

◆ RECORD_RATE

const real_t mcts_line_following::RECORD_RATE = 10.0

◆ RENDER_RATE

const real_t mcts_line_following::RENDER_RATE = 30.0

◆ ROBOT_RADIUS

const real_t mcts_line_following::ROBOT_RADIUS = 0.3

◆ ROLLOUT_APPROACH

const real_t mcts_line_following::ROLLOUT_APPROACH = 2.0

◆ ROLLOUT_GAIN

const real_t mcts_line_following::ROLLOUT_GAIN = 2.0

◆ ROLLOUT_RANDOM

const real_t mcts_line_following::ROLLOUT_RANDOM = 0.2

◆ SEARCH

const MCTSConfig mcts_line_following::SEARCH
Initial value:
{ 400, 25, 0.5,
0.98, 42}

◆ START

const Point mcts_line_following::START {-1.3, -TRACK_HALF_WIDTH}

◆ STEP_SIZE

const real_t mcts_line_following::STEP_SIZE = 0.01

◆ TIME_LIMIT

const real_t mcts_line_following::TIME_LIMIT = 150.0

◆ TRACK

◆ TRACK_CORNER_RADIUS

const real_t mcts_line_following::TRACK_CORNER_RADIUS = 0.7

◆ TRACK_HALF_LENGTH

const real_t mcts_line_following::TRACK_HALF_LENGTH = 2.2

◆ TRACK_HALF_WIDTH

const real_t mcts_line_following::TRACK_HALF_WIDTH = 1.4

◆ WINDOW_TITLE

const std::string mcts_line_following::WINDOW_TITLE = "Line following with Monte Carlo tree search"