Remote Controlled Servo (RC Servo)#

Soft Driver#

Defined in namespace hal::soft

#include <libhal-soft/rc_servo.hpp>

class rc_servo : public hal::servo#

Generic RC servo driver.

Public Functions

rc_servo(hal::pwm &p_pwm, settings p_settings)#

Create a rc_servo object.

Parameters:
  • p_pwm – - pwm signal connected to the RC servo

  • p_settings – - RC servo settings

struct settings#

Information about the RC servo needed to control it properly.

Public Members

hal::hertz frequency = 50#

PWM signal frequency. Check the documentation for the RC servo to determine what range of frequencies can be used with it.

hal::degrees min_angle = 0#

The physical minimum angle that the servo shaft can move to.

hal::degrees max_angle = 90#

The physical maximum angle that the servo shaft can move to.

std::uint32_t min_microseconds = 1000#

The minimum pulse width in microseconds that maps to the minimum angle of the servo.

std::uint32_t max_microseconds = 2000#

The maximum pulse width in microseconds that maps to the maximum angle of the servo.