firmware.robot package

Submodules

firmware.robot.model module

Model for robot that defines the robot’s body parts.

class firmware.robot.model.Arm(motors=<factory>)[source]

Bases: BodyPart

class firmware.robot.model.Body(left_arm=None, right_arm=None, left_leg=None, right_leg=None)[source]

Bases: object

property all_motors: List[MotorInterface]
left_arm: Optional[Arm] = None
left_leg: Optional[Leg] = None
property motor_ids: List[int]
right_arm: Optional[Arm] = None
right_leg: Optional[Leg] = None
class firmware.robot.model.BodyPart(motors=<factory>)[source]

Bases: object

property motor_ids: List[int]
motors: List[MotorInterface]
class firmware.robot.model.Leg(motors=<factory>)[source]

Bases: BodyPart

firmware.robot.robot module

Robot class for controlling a robot that is motor agnostic.

class firmware.robot.robot.Robot(config_path='config.yaml', setup='full_body')[source]

Bases: object

calibrate_motors()[source]

Calibrate all motors.

Return type:

None

disable_motors()[source]

Disable all motors (only available for Robstride motors).

Return type:

None

static filter_motor_values(values, max_val)[source]

Filter motor values to ensure they do not exceed the maximum values.

Parameters:
  • values (List[float]) – The values to filter

  • max_val (List[float]) – The maximum values for each motor

Return type:

List[float]

Returns:

The filtered values

get_motor_positions()[source]

Get the positions of all motors.

Return type:

Dict[str, List[float]]

get_motor_speeds()[source]

Get the speeds of all motors.

Return type:

Dict[str, List[float]]

set_position(new_positions, offset=None, radians=False)[source]

Set the position of the robot to a new position.

Parameters:
  • new_positions (Dict[str, List[float]]) – The new positions for each body part as a dictionary like {“right_leg”: [0, 0, 0, 0, 0, 0]}

  • offset (Optional[Dict[str, List[float]]]) – The offset to apply to the new positions (optional), formatted the same as new_positions

  • radians (bool) – Whether the values should be interpreted as radians (optional)

Return type:

None

test_motors(low=0, high=10, total_sign=1, radians=False, timeout=0.1)[source]

Test all motors by setting them to a range of values from low to high.

Parameters:
  • low (int) – The lower bound of the range

  • high (int) – The upper bound of the range

  • total_sign (int) – The total sign to apply to the motors

  • radians (bool) – Whether the values should be interpreted as radians

  • timeout (float) – Time to sleep in between sets

Return type:

None

update_motor_data()[source]

Update the position and speed of all motors.

Return type:

None

zero_out()[source]

Zero out all motors.

Return type:

None

firmware.robot.robot.deg_to_rad(deg)[source]
Return type:

float

firmware.robot.robot.rad_to_deg(rad)[source]
Return type:

float

firmware.robot.robot_test module

Robot Control Test Module.

This module contains test functions for various robot control operations and a main function for basic robot initialization.

Functions:
test_filter_motor_values() -> None:

Test the filter_motor_values method of the Robot class.

test_zero_out() -> None:

Test the zero_out method of the Robot class.

test_set_position() -> None:

Test the set_position method of the Robot class.

main() -> None:

Initialize a Robot object and set it to its zero position.

The module includes tests for filtering motor values, zeroing out the robot’s position, and setting the robot’s position. It also provides a simple main function to initialize a robot and set it to its zero position.

Usage:

Run this script directly to execute the main function, which initializes a robot and sets it to its zero position. The test functions can be run separately using a testing framework.

Note

This module assumes the existence of a Robot class with specific methods. Ensure

that the Robot class and its dependencies are properly implemented and available.

firmware.robot.robot_test.main()[source]
Return type:

None

firmware.robot.robot_test.test_filter_motor_values()[source]
Return type:

None

firmware.robot.robot_test.test_set_position()[source]
Return type:

None

firmware.robot.robot_test.test_zero_out()[source]
Return type:

None

Module contents