Viam C++ SDK current
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
viam::sdk::Servo Class Referenceabstract

#include "components/servo.hpp"

+ Inheritance diagram for viam::sdk::Servo:

Public Types

typedef uint32_t position
 

Public Member Functions

API api () const override
 Returns the API associated with a particular resource.
 
void move (uint32_t angle_deg)
 Move the servo to the provided angle.
 
virtual void move (uint32_t angle_deg, const ProtoStruct &extra)=0
 Move the servo to the provided angle.
 
position get_position ()
 Get the current angle (degrees) of the servo.
 
virtual position get_position (const ProtoStruct &extra)=0
 Reports the position of the robot's servo relative to its zero position.
 
virtual bool is_moving ()=0
 Reports if a component is in motion.
 
virtual ProtoStruct do_command (const ProtoStruct &command)=0
 Send/receive arbitrary commands to the resource.
 
std::vector< GeometryConfigget_geometries ()
 Returns GeometryConfigs associated with the calling servo.
 
virtual std::vector< GeometryConfigget_geometries (const ProtoStruct &extra)=0
 Returns GeometryConfigs associated with the calling servo.
 
- Public Member Functions inherited from viam::sdk::Component
Name get_resource_name () const override
 Returns the Name for a particular resource.
 
- Public Member Functions inherited from viam::sdk::Resource
 Resource (std::string name)
 
virtual std::string name () const
 Return the resource's name.
 
- Public Member Functions inherited from viam::sdk::Stoppable
virtual void stop (const ProtoStruct &extra)=0
 Stops a resource from running.
 
void stop ()
 Stops a resource from running.
 

Protected Member Functions

 Servo (std::string name)
 
- Protected Member Functions inherited from viam::sdk::Component
 Component (std::string name)
 
- Protected Member Functions inherited from viam::sdk::Resource
Name get_resource_name (const std::string &type) const
 

Additional Inherited Members

- Static Public Member Functions inherited from viam::sdk::Stoppable
static void stop_if_stoppable (const std::shared_ptr< Resource > &resource, const ProtoStruct &extra)
 Stops a Resource if it is Stoppable.
 
static void stop_if_stoppable (const std::shared_ptr< Resource > &resource)
 Stops a Resource if it is Stoppable.
 

Detailed Description

This acts as an abstract base class to be inherited form by any drivers representing specific servo implementations. This class cannot be used on its own.

Member Function Documentation

◆ api()

API viam::sdk::Servo::api ( ) const
overridevirtual

Returns the API associated with a particular resource.

Implements viam::sdk::Resource.

◆ do_command()

virtual ProtoStruct viam::sdk::Servo::do_command ( const ProtoStruct & command)
pure virtual

Send/receive arbitrary commands to the resource.

Parameters
Commandthe command to execute.
Returns
The result of the executed command.

Implemented in viam::sdk::impl::ServoClient.

◆ get_geometries() [1/2]

std::vector< GeometryConfig > viam::sdk::Servo::get_geometries ( )
inline

Returns GeometryConfigs associated with the calling servo.

Returns
The requested GeometryConfigs associated with the component.

◆ get_geometries() [2/2]

virtual std::vector< GeometryConfig > viam::sdk::Servo::get_geometries ( const ProtoStruct & extra)
pure virtual

Returns GeometryConfigs associated with the calling servo.

Parameters
extraAny additional arguments to the method.
Returns
The requested GeometryConfigs associated with the component.

Implemented in viam::sdk::impl::ServoClient, and viam::sdk::impl::ServoClient.

◆ get_position() [1/2]

position viam::sdk::Servo::get_position ( )
inline

Get the current angle (degrees) of the servo.

Exceptions
`Exception`if position reporting is not supported

◆ get_position() [2/2]

virtual position viam::sdk::Servo::get_position ( const ProtoStruct & extra)
pure virtual

Reports the position of the robot's servo relative to its zero position.

Parameters
extraAny additional arguments to the method
Exceptions
`Exception`if position reporting is not supported

Implemented in viam::sdk::impl::ServoClient, and viam::sdk::impl::ServoClient.

◆ is_moving()

virtual bool viam::sdk::Servo::is_moving ( )
pure virtual

Reports if a component is in motion.

Implemented in viam::sdk::impl::ServoClient.

◆ move() [1/2]

void viam::sdk::Servo::move ( uint32_t angle_deg)
inline

Move the servo to the provided angle.

Parameters
angle_degThe desired angle of the servo in degrees.

◆ move() [2/2]

virtual void viam::sdk::Servo::move ( uint32_t angle_deg,
const ProtoStruct & extra )
pure virtual

Move the servo to the provided angle.

Parameters
angle_degThe desired angle of the servo in degrees.
extraAny additional arguments to the method.

Implemented in viam::sdk::impl::ServoClient, and viam::sdk::impl::ServoClient.


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