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

Classes

struct  LineReading
struct  Segment
struct  Path
struct  Start
struct  Command
class  LineFollower
class  SquarePathDriver
class  World
class  Display
struct  Options
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  DownwardCamera
 A camera on a robot that looks straight down at the floor ahead. More...
class  FloorImage
 An image of the floor, centred on the world origin. More...
struct  CameraFrame
 A frame delivered by a camera backend. More...
class  MJPEG_HTTPCameraBackend
 Receives the frames of an MJPEG stream over HTTP, the multipart/x-mixed-replace response that many cameras and camera servers give, for example example 31's FastAPI server on a Raspberry Pi. More...

Typedefs

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

Functions

cv::Mat to_gray (const cv::Mat &image)
cv::Mat dark_pixels (const cv::Mat &gray)
LineReading read_line (const cv::Mat &view, const DownwardCamera &camera)
std::optional< Path > find_square (const FloorImage &floor)
std::optional< std::pair< Segment, real_t > > find_segment (const FloorImage &floor)
real_t nearest_side_heading (const Path &path, const Point &p)
Start start_on_square (const Path &square)
Segment counterclockwise (const Segment &side, const Point &centre)
Start start_on_side (const Segment &side)
Options parse (int argc, char **argv)
std::optional< std::pair< Segment, real_t > > wait_for_next_side (const MJPEG_HTTPCameraBackend &stream, real_t floor_width, real_t timeout)
int run (const Options &options)
real_t milliseconds_since (WallClock::time_point t)
 The milliseconds since a time point.

Variables

const std::string DEFAULT_SERVER = "http://alex-rpi-5.local:8000"
const std::string SQUARE_PATH_ENDPOINT = "/odysseus/camera/square-path"
const std::string CAMERA_ENDPOINT = "/odysseus/camera"
const std::string ROBOT_FILE = bitsim::consts::ROBOTS_DIR + "/bitsim_diff_drive_robot.json"
const std::string WINDOW_TITLE = "A line following robot with a Raspberry Pi camera"
const real_t PI = bitsim::consts::maths::PI
const real_t STEP_SIZE = 0.01
const real_t DEFAULT_FLOOR_WIDTH = 3.0
const real_t TIME_LIMIT = 120.0
const real_t PRINT_PERIOD = 1.0
const real_t CRUISE_SPEED = 0.25
const real_t MIN_SPEED_RATIO = 0.3
const real_t MAX_TURN_RATE = 1.5
const real_t SEARCH_TURN_RATE = 0.6
const real_t LOST_TIME = 5.0
const real_t WAIT_TIME = 15.0
const real_t MIN_LINE_COVERAGE = 0.01
const real_t SQUARE_PATH_SPEED = 0.35
const real_t CORNER_TURN_RATE = 1.5
const real_t STOP_GAIN = 2.0
const real_t DARK_RATIO = 0.6

Typedef Documentation

◆ Point

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

◆ real_t

◆ uint_t

Function Documentation

◆ counterclockwise()

Segment pi_camera_line_following::counterclockwise ( const Segment & side,
const Point & centre )

◆ dark_pixels()

cv::Mat pi_camera_line_following::dark_pixels ( const cv::Mat & gray)

◆ find_segment()

std::optional< std::pair< Segment, real_t > > pi_camera_line_following::find_segment ( const FloorImage & floor)

◆ find_square()

std::optional< Path > pi_camera_line_following::find_square ( const FloorImage & floor)

◆ milliseconds_since()

real_t bitsim::utils::milliseconds_since ( WallClock::time_point t)
inline

The milliseconds since a time point.

◆ nearest_side_heading()

real_t pi_camera_line_following::nearest_side_heading ( const Path & path,
const Point & p )

◆ parse()

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

◆ read_line()

LineReading pi_camera_line_following::read_line ( const cv::Mat & view,
const DownwardCamera & camera )

◆ run()

int pi_camera_line_following::run ( const Options & options)

◆ start_on_side()

Start pi_camera_line_following::start_on_side ( const Segment & side)

◆ start_on_square()

Start pi_camera_line_following::start_on_square ( const Path & square)

◆ to_gray()

cv::Mat pi_camera_line_following::to_gray ( const cv::Mat & image)

◆ wait_for_next_side()

std::optional< std::pair< Segment, real_t > > pi_camera_line_following::wait_for_next_side ( const MJPEG_HTTPCameraBackend & stream,
real_t floor_width,
real_t timeout )

Variable Documentation

◆ CAMERA_ENDPOINT

const std::string pi_camera_line_following::CAMERA_ENDPOINT = "/odysseus/camera"

◆ CORNER_TURN_RATE

const real_t pi_camera_line_following::CORNER_TURN_RATE = 1.5

◆ CRUISE_SPEED

const real_t pi_camera_line_following::CRUISE_SPEED = 0.25

◆ DARK_RATIO

const real_t pi_camera_line_following::DARK_RATIO = 0.6

◆ DEFAULT_FLOOR_WIDTH

const real_t pi_camera_line_following::DEFAULT_FLOOR_WIDTH = 3.0

◆ DEFAULT_SERVER

const std::string pi_camera_line_following::DEFAULT_SERVER = "http://alex-rpi-5.local:8000"

◆ LOST_TIME

const real_t pi_camera_line_following::LOST_TIME = 5.0

◆ MAX_TURN_RATE

const real_t pi_camera_line_following::MAX_TURN_RATE = 1.5

◆ MIN_LINE_COVERAGE

const real_t pi_camera_line_following::MIN_LINE_COVERAGE = 0.01

◆ MIN_SPEED_RATIO

const real_t pi_camera_line_following::MIN_SPEED_RATIO = 0.3

◆ PI

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

◆ PRINT_PERIOD

const real_t pi_camera_line_following::PRINT_PERIOD = 1.0

◆ ROBOT_FILE

const std::string pi_camera_line_following::ROBOT_FILE = bitsim::consts::ROBOTS_DIR + "/bitsim_diff_drive_robot.json"

◆ SEARCH_TURN_RATE

const real_t pi_camera_line_following::SEARCH_TURN_RATE = 0.6

◆ SQUARE_PATH_ENDPOINT

const std::string pi_camera_line_following::SQUARE_PATH_ENDPOINT = "/odysseus/camera/square-path"

◆ SQUARE_PATH_SPEED

const real_t pi_camera_line_following::SQUARE_PATH_SPEED = 0.35

◆ STEP_SIZE

const real_t pi_camera_line_following::STEP_SIZE = 0.01

◆ STOP_GAIN

const real_t pi_camera_line_following::STOP_GAIN = 2.0

◆ TIME_LIMIT

const real_t pi_camera_line_following::TIME_LIMIT = 120.0

◆ WAIT_TIME

const real_t pi_camera_line_following::WAIT_TIME = 15.0

◆ WINDOW_TITLE

const std::string pi_camera_line_following::WINDOW_TITLE = "A line following robot with a Raspberry Pi camera"