Viam C++ SDK current
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
viam::sdk::impl::ServoClient Class Reference

gRPC client implementation of a Servo component. More...

#include <servo_client.hpp>

+ Inheritance diagram for viam::sdk::impl::ServoClient:

Public Types

using interface_type = Servo
 
using StubType = viam::component::servo::v1::ServoService::StubInterface
 
- Public Types inherited from viam::sdk::Servo
typedef uint32_t position
 

Public Member Functions

 ServoClient (std::string name, std::shared_ptr< grpc::Channel > channel)
 
void move (uint32_t angle_deg, const ProtoStruct &extra) override
 Move the servo to the provided angle.
 
position get_position (const ProtoStruct &extra) override
 Reports the position of the robot's servo relative to its zero position.
 
void stop (const ProtoStruct &extra) override
 Stops a resource from running.
 
bool is_moving () override
 Reports if a component is in motion.
 
std::vector< GeometryConfigget_geometries (const ProtoStruct &extra) override
 Returns GeometryConfigs associated with the calling servo.
 
ProtoStruct do_command (const ProtoStruct &command) override
 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.
 
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.
 
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.
 
- Public Member Functions inherited from viam::sdk::Servo
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.
 
position get_position ()
 Get the current angle (degrees) of the servo.
 
std::vector< GeometryConfigget_geometries ()
 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
void stop ()
 Stops a resource from running.
 

Public Attributes

std::unique_ptr< StubType > stub_
 
std::shared_ptr< grpc::Channel > channel_
 

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.
 
- Protected Member Functions inherited from viam::sdk::Servo
 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
 

Detailed Description

gRPC client implementation of a Servo component.

Member Function Documentation

◆ do_command()

ProtoStruct viam::sdk::impl::ServoClient::do_command ( const ProtoStruct & command)
overridevirtual

Send/receive arbitrary commands to the resource.

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

Implements viam::sdk::Servo.

◆ get_geometries() [1/3]

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/3]

std::vector< GeometryConfig > viam::sdk::impl::ServoClient::get_geometries ( const ProtoStruct & extra)
overridevirtual

Returns GeometryConfigs associated with the calling servo.

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

Implements viam::sdk::Servo.

◆ get_geometries() [3/3]

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

Returns GeometryConfigs associated with the calling servo.

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

Implements viam::sdk::Servo.

◆ get_position() [1/3]

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/3]

position viam::sdk::impl::ServoClient::get_position ( const ProtoStruct & extra)
overridevirtual

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

Implements viam::sdk::Servo.

◆ get_position() [3/3]

virtual position viam::sdk::Servo::get_position ( const ProtoStruct & extra)
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

Implements viam::sdk::Servo.

◆ is_moving()

bool viam::sdk::impl::ServoClient::is_moving ( )
overridevirtual

Reports if a component is in motion.

Implements viam::sdk::Servo.

◆ move() [1/3]

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/3]

void viam::sdk::impl::ServoClient::move ( uint32_t angle_deg,
const ProtoStruct & extra )
overridevirtual

Move the servo to the provided angle.

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

Implements viam::sdk::Servo.

◆ move() [3/3]

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

Move the servo to the provided angle.

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

Implements viam::sdk::Servo.

◆ stop()

void viam::sdk::impl::ServoClient::stop ( const ProtoStruct & extra)
overridevirtual

Stops a resource from running.

Parameters
extraExtra arguments to pass to the resource's stop method.

Implements viam::sdk::Stoppable.


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