Servo#

Hardware Interface#

Defined in namespace hal

#include <libhal/servo.hpp>

class servo#

Hardware abstraction for a closed loop position controlled rotational actuator.

Subclassed by hal::actuator::rc_servo, hal::actuator::rmd_drc_servo, hal::actuator::rmd_mc_x_servo, hal::mock::servo, hal::soft::rc_servo

Public Functions

inline void position(hal::degrees p_position)#

Set the position of the servo’s output shaft.

Position is the rotational position as a angle in degrees that the caller wants the shaft to rotate to. The allowed range of positions is defined by the servo itself. Many servos have intrinsic limits to their range.

Developers must choose servos that fit the range for their applications. Applications must clearly define the range that they require in order to perform correctly.

The velocity in which the servo shaft moves is not defined by this function but is either intrinsic to the servo or a configuration of the servo.

Parameters:

p_position – - the position to move the servo shaft in degrees.

Throws:

hal::argument_out_of_domain – - when position exceeds the range of the servo. When this error occurs, the guaranteed behavior is that the servo keeps its last set position.