feathersdk.robot.navigation_platform Module

exception feathersdk.robot.navigation_platform.NavigationMotorError

Bases: Exception

Exception raised when motor errors are detected during navigation commands.

class feathersdk.robot.navigation_platform.ThreeWheelServeDrivePlatform(motors_manager: MotorsManager, config: dict, power: BatterySystem = None)

Bases: SteppableSystem

ALL_MOTORS = ['BwC', 'BwR', 'BwL', 'BpC', 'BpR', 'BpL']
SPINNING_MOTORS = ['BpC', 'BpR', 'BpL']
TURNING_MOTORS = ['BwC', 'BwR', 'BwL']
__init__(motors_manager: MotorsManager, config: dict, power: BatterySystem = None)

Initialize three-wheel swerve drive navigation platform.

Parameters:
  • motors_manager (MotorsManager) – Manager for motor communication

  • config (dict) – Configuration dict with “motors” and “nav_planner” keys

  • power (BatterySystem, optional) – Battery system instance for power management

disable_drive_motor_current()
disable_motors()
enable_drive_motor_current()
enable_motors()
get_system_state()

Get current system state: turning motor angles and spinning motor velocities.

Returns:

Dictionary with keys like “BwC_angle”, “BpC_velocity” etc.

Values are angles in radians for turning motors and velocities in rad/s for spinning motors.

Return type:

Dict[str, float]

health_check()

Perform health check on all motors.

Returns:

Dictionary with keys:
  • ”calibration_state”: Current calibration state name

  • ”enabled”: Whether navigation planner is enabled

  • Per-motor keys with parameters: mech_pos, loc_ref, mech_vel, iqf, loc_kp, temp, torque, angle_internal, angle, velocity

Return type:

dict

is_aborting()
is_motors_enabled()

Check if all motors are in Run mode.

Returns:

True if all motors are in Run mode, False otherwise

Return type:

bool

load_calibration_data()

Load calibration data and check motor health.

Raises:

Exception – If checking motor health fails, calibration_state is set to UNCALIBRATED

on_abort()

Disable motors on system abort.

on_fork()
on_power_event(event: PowerEvent)

Handle power events from the BatterySystem.

Parameters:

event (PowerEvent) – The power event (POWER_OFF or POWER_RESTORED)

recalibrate()

Recalibrate all turning motors.

Finds range, zeros at homing position, and saves calibration data.

Raises:

Exception – If already recalibrating or calibration fails

class feathersdk.robot.navigation_platform.VelocityNavigationPlanner(nav_platform, config: dict)

Bases: NavigationPlanner

Allows the robot to be controlled by a specified velocity. TODO: The name of this class is misleading. A Planner builds a plan but does not control the robot in pure terms. This should be called VelocityController to better represent its purpose. Leaving for now for backward compatibility.

Developer Notes: Any public methods of this class should follow _validate_and_accept_command() pattern in existing methods to ensure safety and error handling.

disable_motors(is_power_off: bool = False)

Disable motors and clear command state.

Parameters:

is_power_off (bool) – If True, motors are not disabled (for power-off scenarios)

enable_motors()

Enable all navigation motors and verify they enter Run mode.

Raises:
  • UnknownInterfaceError – If communication interface is not available, platform is disabled.

  • Exception – If enabling motors fails for any reason, platform is disabled.

go_to(degrees, speed, motors_is_on=False)

Set wheel orientation and speed for directional movement.

Parameters:
  • degrees (float) – Target wheel angle in degrees from -90 to 90 (0 = forward). All wheels will be turned to this angle.

  • speed (float) – Target linear speed in m/s, range -1.3 to 1.3 m/s.

  • motors_is_on (bool) – If False, enables motors before command. If True, assumes motors already enabled.

Raises:
  • ValueError – If degrees or speed are outside valid ranges

  • Exception – If platform not enabled or calibration state is unhealthy

  • NavigationMotorError – If motor errors occurred in previous step() execution

Note

For target angles of exactly -90 or +90, each turning motor will choose whichever angle is closer to its current position to minimize rotation. The speed sign is adjusted per motor accordingly to maintain the intended direction of travel. This optimization is applied in step() at execution time.

is_at_target_position()

Check if robot is at target position.

For velocity-based control, this always returns True as there is no discrete target position.

Returns:

Always True for velocity control mode

Return type:

bool

orient_angle(degrees)

Set wheel orientation without changing speed.

Parameters:

degrees (float) – Target angle in degrees from -90 to 90 (0 = forward, clockwise positive).

Raises:
  • Exception – If platform not enabled or calibration state is unhealthy

  • NavigationMotorError – If motor errors occurred in previous step() execution

orient_rotate()

Orient wheels to rotation configuration and stop spinning motors.

Raises:
  • Exception – If platform not enabled or calibration state is unhealthy

  • NavigationMotorError – If motor errors occurred in previous step() execution

rotate_in_place(speed)

Rotate the robot in place by setting the speed of the spinning motors.

Parameters:

speed (float) – The speed in degrees/second at which all the spinning motors will rotate.

Raises:
  • Exception – If platform not enabled or calibration state is unhealthy

  • NavigationMotorError – If motor errors occurred in previous step() execution

set_motor_shutdown_on_abort(shutdown_on_abort: bool)
set_speed(speed)

Set linear speed without changing wheel orientation.

Parameters:

speed (float) – Linear speed in m/s, range -1.3 to 1.3 m/s.

Raises:
  • ValueError – If speed is outside valid range

  • Exception – If platform not enabled or calibration state is unhealthy

  • NavigationMotorError – If motor errors occurred in previous step() execution

step()

Execute pending navigation commands and monitor feedback delays.

When feedback delay is detected on any motor, the robot is stopped (zero velocity sent once) and the step loop is paused until delay clears. During pause, feedback is triggered (set_active_reporting(False)) so delay can be re-checked. No exception is raised; commands are not sent until pause ends.