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 AttributeMap &extra) override
 Move the servo to the provided angle.
 
position get_position (const AttributeMap &extra) override
 Reports the position of the robot's servo relative to its zero position.
 
void stop (const AttributeMap &extra) override
 Stops a resource from running.
 
bool is_moving () override
 Reports if a component is in motion.
 
std::vector< GeometryConfigget_geometries (const AttributeMap &extra) override
 Returns GeometryConfigs associated with the calling servo.
 
AttributeMap do_command (const AttributeMap &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 AttributeMap &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 AttributeMap &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 AttributeMap &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
viam::common::v1::ResourceName get_resource_name (std::string name) const override
 Returns a ResourceName for a particular resource name.
 
- 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::Servo
static position from_proto (const viam::component::servo::v1::GetPositionResponse &proto)
 Creates a position struct from its proto representation.
 
- Static Public Member Functions inherited from viam::sdk::Stoppable
static void stop_if_stoppable (const std::shared_ptr< Resource > &resource, const AttributeMap &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)
 

Detailed Description

gRPC client implementation of a Servo component.

Member Function Documentation

◆ do_command()

AttributeMap viam::sdk::impl::ServoClient::do_command ( const AttributeMap & 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 AttributeMap & 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 AttributeMap & 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 AttributeMap & 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 AttributeMap & 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 AttributeMap & 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 AttributeMap & 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 AttributeMap & 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: