firmware.robot package¶
Submodules¶
firmware.robot.model module¶
Model for robot that defines the robot’s body parts.
- 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]¶
 
- property motor_ids: List[int]¶
 
- class firmware.robot.model.BodyPart(motors=<factory>)[source]¶
 Bases:
object- property motor_ids: List[int]¶
 
- 
motors: 
List[MotorInterface]¶ 
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- 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 filtermax_val (
List[float]) – The maximum values for each motor
- Return type:
 List[float]- Returns:
 The filtered values
- 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_positionsradians (
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 rangehigh (
int) – The upper bound of the rangetotal_sign (
int) – The total sign to apply to the motorsradians (
bool) – Whether the values should be interpreted as radianstimeout (
float) – Time to sleep in between sets
- Return type:
 None
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.