bitsim
Model, simulate, estimate and control robots in C++
Loading...
Searching...
No Matches
wheel_odometry.cpp File Reference
#include "bitsim/bitsim_consts.h"
#include "bitsim/bitsim_types.h"
#include "bitsim/control/infrared_line_follower.h"
#include "bitsim/estimation/diff_drive_odometry.h"
#include "bitsim/estimation/gyro_heading.h"
#include "bitsim/rigid_bodies/chrono_robots/contact_counter.h"
#include "bitsim/rigid_bodies/chrono_robots/diff_drive_robot.h"
#include "bitsim/sensors/backends/chrono_imu_backend.h"
#include "bitsim/sensors/backends/chrono_ultrasound_backend.h"
#include "bitsim/sensors/downward_camera.h"
#include "bitsim/sensors/imu_sensor.h"
#include "bitsim/sensors/infrared_sensor.h"
#include "bitsim/sensors/ultrasonic_sensor.h"
#include "bitsim/trajectory/rounded_rectangle.h"
#include "bitsim/utils/render/irrlicht_scene.h"
#include "bitsim/utils/render/irrlicht_utils.h"
#include <chrono/physics/ChBodyEasy.h>
#include <chrono/physics/ChContactMaterialNSC.h>
#include <chrono/physics/ChSystemNSC.h>
#include <chrono_irrlicht/ChVisualSystemIrrlicht.h>
#include <algorithm>
#include <array>
#include <chrono>
#include <cmath>
#include <cstdlib>
#include <filesystem>
#include <iomanip>
#include <iostream>
#include <memory>
#include <optional>
#include <sstream>
#include <stdexcept>
#include <string>
#include <thread>
#include <vector>
Include dependency graph for wheel_odometry.cpp:

Classes

class  wheel_odometry::Driver
class  wheel_odometry::World
class  wheel_odometry::Display
struct  wheel_odometry::Options
class  wheel_odometry::InfraredLineFollower
 Follow a dark line with a row of infrared elements. More...
class  wheel_odometry::DiffDriveOdometry
 Dead reckoning for a differential drive robot from its wheel encoders. More...
class  wheel_odometry::GyroHeading
 The heading of a robot from its gyroscope: dead reckoning of the rate about the vertical. More...
class  wheel_odometry::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  wheel_odometry::ContactCounter
 Counts the contacts that touch any of a set of bodies, such as the obstacles a robot should not hit. More...
class  wheel_odometry::FloorImage
 An image of the floor, centred on the world origin. More...
class  wheel_odometry::IMUSensor
 An inertial measurement unit: a three axis accelerometer and a three axis gyroscope, along the axes of the body it is on. More...
class  wheel_odometry::InfraredSensor
 An array of infrared reflectance elements that looks at the floor, to tell its colour: light paper or a dark line. More...
class  wheel_odometry::UltrasonicSensor
 Class for modelling ultrasonic sensors. More...
class  wheel_odometry::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  wheel_odometry::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  wheel_odometry::InsetCamera
 A camera on a robot whose view is drawn in the top left corner of the window. It only shows the scene; mouse and keyboard still move the main camera. More...
class  wheel_odometry::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...

Namespaces

namespace  wheel_odometry

Typedefs

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

Functions

FloorImage wheel_odometry::draw_floor ()
std::string wheel_odometry::to_string (Driver::State state)
Options wheel_odometry::parse (int argc, char **argv)
int wheel_odometry::run (const Options &options)
int main (int argc, char **argv)

Variables

const std::string wheel_odometry::ROBOT_FILE = bitsim::consts::ROBOTS_DIR + "/bitsim_diff_drive_robot.json"
const std::string wheel_odometry::WINDOW_TITLE = "Odometry from the wheel encoders"
const real_t wheel_odometry::PI = bitsim::consts::maths::PI
const real_t wheel_odometry::STEP_SIZE = 0.01
const real_t wheel_odometry::TIME_LIMIT = 150.0
const real_t wheel_odometry::PRINT_PERIOD = 1.0
const real_t wheel_odometry::RENDER_RATE = 30.0
const real_t wheel_odometry::RECORD_RATE = 10.0
const real_t wheel_odometry::TRACK_HALF_LENGTH = 2.2
const real_t wheel_odometry::TRACK_HALF_WIDTH = 1.4
const real_t wheel_odometry::TRACK_CORNER_RADIUS = 0.7
const real_t wheel_odometry::LINE_WIDTH = 0.05
const real_t wheel_odometry::FLOOR_WIDTH = 5.6
const real_t wheel_odometry::FLOOR_HEIGHT = 4.6
const real_t wheel_odometry::METRES_PER_PIXEL = 0.005
const uchar wheel_odometry::PAPER = 235
const uchar wheel_odometry::INK = 25
const std::vector< Point > wheel_odometry::OBSTACLES {{0.0, -TRACK_HALF_WIDTH}, {-0.2, TRACK_HALF_WIDTH}}
const real_t wheel_odometry::OBSTACLE_SIZE = 0.3
const real_t wheel_odometry::OBSTACLE_HEIGHT = 0.4
const Point wheel_odometry::START {-1.3, -TRACK_HALF_WIDTH}
const real_t wheel_odometry::CRUISE_SPEED = 0.3
const real_t wheel_odometry::LINE_TURN_RATE = 1.6
const real_t wheel_odometry::SEARCH_TURN_RATE = 0.8
const real_t wheel_odometry::LOST_TIME = 3.0
const real_t wheel_odometry::STOP_DISTANCE = 0.5
const real_t wheel_odometry::TURN_AWAY_ANGLE = 60.0 * PI / 180
const real_t wheel_odometry::DETOUR_RADIUS = 1.2
const real_t wheel_odometry::DETOUR_SPEED = 0.25
const real_t wheel_odometry::PIVOT_RATE = 1.0
const real_t wheel_odometry::CALIBRATION_TIME = 1.0
const real_t wheel_odometry::TRAIL_STEP = 0.02
const chrono::ChVector3d wheel_odometry::CAMERA_POSITION {0.26, 0.0, 0.07}
const real_t wheel_odometry::CAMERA_TILT = 8.0 * PI / 180
const real_t wheel_odometry::CAMERA_FOV = 60.0 * PI / 180
const int wheel_odometry::CAMERA_WIDTH = 384
const int wheel_odometry::CAMERA_HEIGHT = 216
const RoundedRectangle wheel_odometry::TRACK (TRACK_HALF_LENGTH, TRACK_HALF_WIDTH, TRACK_CORNER_RADIUS)
const InfraredLineFollower::Parameters wheel_odometry::FOLLOW_LINE

Function Documentation

◆ main()

int main ( int argc,
char ** argv )