REVLib - C++
rev::servohub::ServoChannel Class Reference

#include <ServoChannel.h>

Public Types

enum class  ChannelId {
  kChannelId0 = 0 , kChannelId1 = 1 , kChannelId2 = 2 , kChannelId3 = 3 ,
  kChannelId4 = 4 , kChannelId5 = 5
}
 

Public Member Functions

 ~ServoChannel ()
 
ChannelId GetChannelId () const
 
int GetPulseWidth () const
 
bool IsEnabled () const
 
double GetCurrent () const
 
REVLibError SetPulseWidth (int pulseWidth_us)
 
REVLibError SetEnabled (bool enabled)
 
REVLibError SetPowered (bool powered)
 

Static Public Attributes

static constexpr size_t kNumServoChannels {6u}
 

Friends

class ServoHub
 

Member Enumeration Documentation

◆ ChannelId

Enumerator
kChannelId0 
kChannelId1 
kChannelId2 
kChannelId3 
kChannelId4 
kChannelId5 

Constructor & Destructor Documentation

◆ ~ServoChannel()

ServoChannel::~ServoChannel ( )

Closes the ServoChannel

Member Function Documentation

◆ GetChannelId()

ChannelId rev::servohub::ServoChannel::GetChannelId ( ) const
inline

Get the channel ID this ServoChannel.

Returns
Channel channel ID

◆ GetPulseWidth()

int ServoChannel::GetPulseWidth ( ) const
Returns
The pulse width applied to this channel in microseconds.

◆ IsEnabled()

bool ServoChannel::IsEnabled ( ) const
Returns
true if the channel is enabled; false, otherwise

◆ GetCurrent()

double ServoChannel::GetCurrent ( ) const
Returns
The channel's output current in Amps.

◆ SetPulseWidth()

REVLibError ServoChannel::SetPulseWidth ( int  pulseWidth_us)

Sets the servo to the desired location based on the pulse width (in microseconds)

Parameters
[in]pulseWidth_usThe desired pulse width in microseconds

◆ SetEnabled()

REVLibError ServoChannel::SetEnabled ( bool  enabled)

Enables/Disables the servo

Parameters
[in]enabledtrue = enabled, false = disabled

◆ SetPowered()

REVLibError ServoChannel::SetPowered ( bool  powered)

Turns on/off the power to the servo

Parameters
[in]poweredtrue = powered on, false = powered off

Friends And Related Function Documentation

◆ ServoHub

friend class ServoHub
friend

Member Data Documentation

◆ kNumServoChannels

constexpr size_t rev::servohub::ServoChannel::kNumServoChannels {6u}
staticconstexpr

The documentation for this class was generated from the following files: