This package contains modules with implementations of triangula.task.Task. These are typically divided into separate files for each task, each of which is then relatively short and easy to manage.

Main menu class, shows other tasks and allows the user to select one to run. This is used as the root task by default, so pressing SELECT will always jump back to this task.

class triangula.tasks.main_menu.MenuTask[source]

__init__()[source]

Reads from the joystick analogue axes and allows you to drive the robot around. Buttons can switch between relative control (where the robot drives forwards when you push the left stick forwards, whatever direction its facing) and absolute (where the robot will drive in a specific direction, typically the direction it was facing when this mode was selected, irrespective of its current orientation). The display is used to show the current estimate of position and bearing from the dead reckoning algorithm.

class triangula.tasks.manual_control.ManualMotionTask[source]

Class enabling manual control of the robot from the joystick. Uses dead-reckoning for bearing lock, we don’t use the IMU at all in this version of the class, it was proving problematic in real-world conditions and the dead-reckoning logic is surprisingly accurate and stable.

ACCEL_TIME = 1.0

Time to reach full speed from a standing start

__init__()[source]
motion_limit = None

:type : triangula.dynamics.MotionLimit

rate_limit = None

:type : triangula.dynamics.RateLimit

Initialised with a sequence of triangula.navigation.TaskWaypoint instances, this task will drive to each waypoint in sequence, optionally coming to a complete stop at the waypoint before running a sub-task until that task returns an triangula.task.ExitTask at which point it proceeds to the next waypoint. The route can optionally loop to run continuously.

class triangula.tasks.patrol.PatrolTask(waypoints, loop=False, linear_offset=30, angular_offset=0.2, max_power=1.0)[source]

A task which manages movement through a sequence of waypoints, potentially running sub-tasks at each waypoint.

__init__(waypoints, loop=False, linear_offset=30, angular_offset=0.2, max_power=1.0)[source]

Create a new Patrol task, specifying a sequence of waypoints, whether to patrol continuously, and tolerances used to determine when we’ve hit a waypoint and should start executing the waypoint’s task.

Parameters: waypoints – List of triangula.navigation.TaskWaypoint defining the patrol route. loop – Whether to patrol continuously, defaults to False in which case this task will return an ExitTask when it has completed all its waypoints. If True the task will not exit, and will repeatedly run through its list of TaskWaypoint targets until otherwise interrupted. linear_offset – Maximum linear distance away from the target Pose for each waypoint before we consider that we’ve hit it. Specified in mm, defaults to 20 angular_offset – Maximum angular distance away from the target Pose for each waypoint before we consider that we’ve hit it. Specified in radians, defaults to 0.1 max_power – A scale applied to motor speeds being sent to the chassis, defaults to 1.0 to move as fast as possible, lower values might be helpful when testing!

There are a couple of example tasks within the patrol module:

class triangula.tasks.patrol.SimplePatrolExample[source]

Task to test the basics of the patrol logic, just runs a single patrol to 30cm ahead, pauses, then moves sideways. Hopefully. Set to not loop, so should in theory just move in an ‘L’ shape.

__init__()[source]
poll_task(context, tick)[source]

Create a set of simple waypoints and return the appropriate triangula.tasks.patrol.PatrolTask which will visit them in turn then exit.

class triangula.tasks.patrol.TrianglePatrol[source]

Patrol in a cool triangle pattern

__init__()[source]
poll_task(context, tick)[source]

Create a set of waypoints and return an appropriate triangula.tasks.patrol.PatrolTask which will visit them in sequence.

Displays the IP address, if any, for the eth0 and wlan0 interfaces, handy when your robot has picked up an address with DHCP and you’ve no idea what it is.

class triangula.tasks.network_info.NetworkInfoTask[source]

Simple task that gets the network address of the wired and wireless interfaces and displays them on the LCD.

__init__()[source]

class triangula.tasks.compass_test.CompassTestTask[source]
__init__()[source]