libstp
Robotics library for Botball
Loading...
Searching...
No Matches
libstp::hal::servo::Servo Class Reference

#include <Servo.hpp>

Public Member Functions

 Servo (int port)
 Create a servo bound to a platform-defined port index.
 ~Servo ()
void setPosition (float position)
 Command a new servo position in degrees (0-180).
float getPosition () const
 Return the last commanded position in degrees.
void setSmoothPosition (float targetDeg, float speedDegPerSec, int easing)
 Command a smooth move to targetDeg at the given speed; interpolation runs in the C++ reader.
void enable () const
 Enable output while preserving the last commanded position.
void disable () const
 Disable output while preserving the last commanded position.

Static Public Member Functions

static void fullyDisableAll ()
 Force every servo into the platform's fully disabled state.

Public Attributes

int port

Detailed Description

Servo output wrapper implemented by the active platform bundle.

The wrapper caches the last commanded position locally so callers can query getPosition() even when the underlying driver is write-only.

Definition at line 13 of file Servo.hpp.

Constructor & Destructor Documentation

◆ Servo()

libstp::hal::servo::Servo::Servo ( int port)
explicit

Create a servo bound to a platform-defined port index.

◆ ~Servo()

libstp::hal::servo::Servo::~Servo ( )

Member Function Documentation

◆ disable()

void libstp::hal::servo::Servo::disable ( ) const

Disable output while preserving the last commanded position.

◆ enable()

void libstp::hal::servo::Servo::enable ( ) const

Enable output while preserving the last commanded position.

◆ fullyDisableAll()

void libstp::hal::servo::Servo::fullyDisableAll ( )
static

Force every servo into the platform's fully disabled state.

◆ getPosition()

float libstp::hal::servo::Servo::getPosition ( ) const

Return the last commanded position in degrees.

◆ setPosition()

void libstp::hal::servo::Servo::setPosition ( float position)

Command a new servo position in degrees (0-180).

◆ setSmoothPosition()

void libstp::hal::servo::Servo::setSmoothPosition ( float targetDeg,
float speedDegPerSec,
int easing )

Command a smooth move to targetDeg at the given speed; interpolation runs in the C++ reader.

Member Data Documentation

◆ port

int libstp::hal::servo::Servo::port

Definition at line 26 of file Servo.hpp.


The documentation for this class was generated from the following file:
  • /home/runner/work/raccoon-lib/raccoon-lib/modules/libstp-hal/include/hal/Servo.hpp