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

Classes

class  PiCameraSource
class  SyntheticSource
class  SquarePath
class  FrameGrabber

Functions

 mjpeg_part (jpeg)
 build_app (grabber, square_path, source_name, width, height, fps)
 main ()

Variables

str BOUNDARY = "frame"

Detailed Description

Stream camera frames as MJPEG over HTTP with FastAPI.

The endpoints are the same as those of the Odysseus robot's server, so
the pi_camera_line_following example works with either:

    GET /odysseus/camera              the camera, as an MJPEG stream
    GET /odysseus/camera/square-path  generated frames of a square path, one
                                      side at a time, as an MJPEG stream
    GET /odysseus/camera/frame        the latest camera frame as one JPEG
    GET /odysseus/camera/info         the source, frame size and frame rate

On a Raspberry Pi 5 with a camera module the camera frames come from Picamera2.
Point the camera down at a sheet of paper with a square drawn on it in thick
dark lines. On any other computer, --synthetic draws such a square instead.

The square path needs no camera. Every --period seconds its frame shows the
next side of a square, counterclockwise as seen from above: bottom, right, top,
left. The square is centred in the frame.

Usage
    python camera_server.py                  # Pi camera, port 8000
    python camera_server.py --synthetic      # generated camera frames
    python camera_server.py --help

Function Documentation

◆ build_app()

camera_server.build_app ( grabber,
square_path,
source_name,
width,
height,
fps )

◆ main()

camera_server.main ( )

◆ mjpeg_part()

camera_server.mjpeg_part ( jpeg)

Variable Documentation

◆ BOUNDARY

str camera_server.BOUNDARY = "frame"