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

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

#include <motor_client.hpp>

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

Public Types

using interface_type = Motor
 
- Public Types inherited from viam::sdk::Motor
typedef double position
 

Public Member Functions

 MotorClient (std::string name, std::shared_ptr< grpc::Channel > channel)
 
void set_power (double power_pct, const ProtoStruct &extra) override
 Sets the percentage of the motor's total power that should be employed.
 
void go_for (double rpm, double revolutions, const ProtoStruct &extra) override
 Instructs the motor to turn at a specified speed, which is expressed in RPM, for a specified number of rotations relative to its starting position.
 
void go_to (double rpm, double position_revolutions, const ProtoStruct &extra) override
 Move the motor to a specific position that is relative to its home position at a specified speed which is expressed in RPM.
 
void set_rpm (double rpm, const ProtoStruct &extra) override
 Move the motor indefinitely at a specified speed which is expressed in RPM.
 
void reset_zero_position (double offset, const ProtoStruct &extra) override
 Sets the current position of the motor as the new zero position.
 
position get_position (const ProtoStruct &extra) override
 Reports the position of the robot's motor relative to its zero position.
 
properties get_properties (const ProtoStruct &extra) override
 Returns the properties of the motor which comprises the booleans indicating.
 
void stop (const ProtoStruct &extra) override
 Stops a resource from running.
 
power_status get_power_status (const ProtoStruct &extra) override
 
std::vector< GeometryConfigget_geometries (const ProtoStruct &extra) override
 Returns GeometryConfigs associated with the calling motor.
 
bool is_moving () override
 Reports if a component is in motion.
 
ProtoStruct do_command (const ProtoStruct &command) override
 Send/receive arbitrary commands to the resource.
 
std::vector< GeometryConfigget_geometries ()
 Returns GeometryConfigs associated with the calling motor.
 
virtual std::vector< GeometryConfigget_geometries (const ProtoStruct &extra)=0
 Returns GeometryConfigs associated with the calling motor.
 
position get_position ()
 Reports the position of the robot's motor relative to its zero position.
 
virtual position get_position (const ProtoStruct &extra)=0
 Reports the position of the robot's motor relative to its zero position.
 
power_status get_power_status ()
 
virtual power_status get_power_status (const ProtoStruct &extra)=0
 
properties get_properties ()
 Returns the properties of the motor which comprises the booleans indicating which optional features the robot's motor supports.
 
virtual properties get_properties (const ProtoStruct &extra)=0
 Returns the properties of the motor which comprises the booleans indicating.
 
void go_for (double rpm, double revolutions)
 Instructs the motor to turn at a specified speed, which is expressed in RPM, for a specified number of rotations relative to its starting position.
 
virtual void go_for (double rpm, double revolutions, const ProtoStruct &extra)=0
 Instructs the motor to turn at a specified speed, which is expressed in RPM, for a specified number of rotations relative to its starting position.
 
void go_to (double rpm, double position_revolutions)
 Move the motor to a specific position that is relative to its home position at a specified speed which is expressed in RPM.
 
virtual void go_to (double rpm, double position_revolutions, const ProtoStruct &extra)=0
 Move the motor to a specific position that is relative to its home position at a specified speed which is expressed in RPM.
 
void reset_zero_position (double offset)
 Sets the current position of the motor as the new zero position.
 
virtual void reset_zero_position (double offset, const ProtoStruct &extra)=0
 Sets the current position of the motor as the new zero position.
 
void set_power (double power_pct)
 Sets the percentage of the motor's total power that should be employed.
 
virtual void set_power (double power_pct, const ProtoStruct &extra)=0
 Sets the percentage of the motor's total power that should be employed.
 
void set_rpm (double rpm)
 Move the motor indefinitely at a specified speed which is expressed in RPM.
 
virtual void set_rpm (double rpm, const ProtoStruct &extra)=0
 Move the motor indefinitely at a specified speed which is expressed in RPM.
 
- Public Member Functions inherited from viam::sdk::Motor
void set_power (double power_pct)
 Sets the percentage of the motor's total power that should be employed.
 
void go_for (double rpm, double revolutions)
 Instructs the motor to turn at a specified speed, which is expressed in RPM, for a specified number of rotations relative to its starting position.
 
void go_to (double rpm, double position_revolutions)
 Move the motor to a specific position that is relative to its home position at a specified speed which is expressed in RPM.
 
void set_rpm (double rpm)
 Move the motor indefinitely at a specified speed which is expressed in RPM.
 
void reset_zero_position (double offset)
 Sets the current position of the motor as the new zero position.
 
position get_position ()
 Reports the position of the robot's motor relative to its zero position.
 
properties get_properties ()
 Returns the properties of the motor which comprises the booleans indicating which optional features the robot's motor supports.
 
power_status get_power_status ()
 
std::vector< GeometryConfigget_geometries ()
 Returns GeometryConfigs associated with the calling motor.
 
API api () const override
 Returns the API associated with a particular resource.
 
- 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.
 

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::Motor
 Motor (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 Motor component.

Member Function Documentation

◆ do_command()

ProtoStruct viam::sdk::impl::MotorClient::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::Motor.

◆ get_geometries() [1/3]

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

Returns GeometryConfigs associated with the calling motor.

Returns
The requested GeometryConfigs associated with the component.

◆ get_geometries() [2/3]

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

Returns GeometryConfigs associated with the calling motor.

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

Implements viam::sdk::Motor.

◆ get_geometries() [3/3]

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

Returns GeometryConfigs associated with the calling motor.

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

Implements viam::sdk::Motor.

◆ get_position() [1/3]

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

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

Exceptions
`Exception`if position reporting is not supported

◆ get_position() [2/3]

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

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

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

Implements viam::sdk::Motor.

◆ get_position() [3/3]

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

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

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

Implements viam::sdk::Motor.

◆ get_power_status() [1/3]

power_status viam::sdk::Motor::get_power_status ( )
inline
Returns
The motor's current power_status

◆ get_power_status() [2/3]

power_status viam::sdk::impl::MotorClient::get_power_status ( const ProtoStruct & extra)
overridevirtual
Returns
The motor's current power_status
Parameters
extraAny additional arguments to the method

Implements viam::sdk::Motor.

◆ get_power_status() [3/3]

virtual power_status viam::sdk::Motor::get_power_status ( const ProtoStruct & extra)
virtual
Returns
The motor's current power_status
Parameters
extraAny additional arguments to the method

Implements viam::sdk::Motor.

◆ get_properties() [1/2]

properties viam::sdk::impl::MotorClient::get_properties ( const ProtoStruct & extra)
overridevirtual

Returns the properties of the motor which comprises the booleans indicating.

Parameters
extraAny additional arguments to the method which optional features the robot's motor supports

Implements viam::sdk::Motor.

◆ get_properties() [2/2]

virtual properties viam::sdk::Motor::get_properties ( const ProtoStruct & extra)
virtual

Returns the properties of the motor which comprises the booleans indicating.

Parameters
extraAny additional arguments to the method which optional features the robot's motor supports

Implements viam::sdk::Motor.

◆ go_for() [1/3]

void viam::sdk::Motor::go_for ( double rpm,
double revolutions )
inline

Instructs the motor to turn at a specified speed, which is expressed in RPM, for a specified number of rotations relative to its starting position.

Parameters
rpmSpeed of motor travel in rotations per minute
revolutionsNumber of revolutions relative to motor's start position. If revolutions == 0, this will run the motor at rpm indefinetely. If revolutions != 0, this will block until the number of revolutions has been completed or another operation comes in.
Exceptions
`Exception`if position reporting is not supported

◆ go_for() [2/3]

void viam::sdk::impl::MotorClient::go_for ( double rpm,
double revolutions,
const ProtoStruct & extra )
overridevirtual

Instructs the motor to turn at a specified speed, which is expressed in RPM, for a specified number of rotations relative to its starting position.

Parameters
rpmSpeed of motor travel in rotations per minute
revolutionsNumber of revolutions relative to motor's start position. If revolutions == 0, this will run the motor at rpm indefinetely. If revolutions != 0, this will block until the number of revolutions has been completed or another operation comes in.
extraAny additional arguments to the method.
Exceptions
`Exception`if position reporting is not supported

Implements viam::sdk::Motor.

◆ go_for() [3/3]

virtual void viam::sdk::Motor::go_for ( double rpm,
double revolutions,
const ProtoStruct & extra )
virtual

Instructs the motor to turn at a specified speed, which is expressed in RPM, for a specified number of rotations relative to its starting position.

Parameters
rpmSpeed of motor travel in rotations per minute
revolutionsNumber of revolutions relative to motor's start position. If revolutions == 0, this will run the motor at rpm indefinetely. If revolutions != 0, this will block until the number of revolutions has been completed or another operation comes in.
extraAny additional arguments to the method.
Exceptions
`Exception`if position reporting is not supported

Implements viam::sdk::Motor.

◆ go_to() [1/3]

void viam::sdk::Motor::go_to ( double rpm,
double position_revolutions )
inline

Move the motor to a specific position that is relative to its home position at a specified speed which is expressed in RPM.

Parameters
rpmSpeed of motor travel in rotations per minute
position_revolutionsNumber of revolutions relative to motor's home home/zero
Exceptions
`Exception`if position reporting is not supported

◆ go_to() [2/3]

void viam::sdk::impl::MotorClient::go_to ( double rpm,
double position_revolutions,
const ProtoStruct & extra )
overridevirtual

Move the motor to a specific position that is relative to its home position at a specified speed which is expressed in RPM.

Parameters
rpmSpeed of motor travel in rotations per minute
position_revolutionsNumber of revolutions relative to motor's home home/zero
extraAny additional arguments to the method.
Exceptions
`Exception`if position reporting is not supported

Implements viam::sdk::Motor.

◆ go_to() [3/3]

virtual void viam::sdk::Motor::go_to ( double rpm,
double position_revolutions,
const ProtoStruct & extra )
virtual

Move the motor to a specific position that is relative to its home position at a specified speed which is expressed in RPM.

Parameters
rpmSpeed of motor travel in rotations per minute
position_revolutionsNumber of revolutions relative to motor's home home/zero
extraAny additional arguments to the method.
Exceptions
`Exception`if position reporting is not supported

Implements viam::sdk::Motor.

◆ is_moving()

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

Reports if a component is in motion.

Implements viam::sdk::Motor.

◆ reset_zero_position() [1/3]

void viam::sdk::Motor::reset_zero_position ( double offset)
inline

Sets the current position of the motor as the new zero position.

Parameters
offsetMotor position
Exceptions
`Exception`if position reporting is not supported

◆ reset_zero_position() [2/3]

void viam::sdk::impl::MotorClient::reset_zero_position ( double offset,
const ProtoStruct & extra )
overridevirtual

Sets the current position of the motor as the new zero position.

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

Implements viam::sdk::Motor.

◆ reset_zero_position() [3/3]

virtual void viam::sdk::Motor::reset_zero_position ( double offset,
const ProtoStruct & extra )
virtual

Sets the current position of the motor as the new zero position.

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

Implements viam::sdk::Motor.

◆ set_power() [1/3]

void viam::sdk::Motor::set_power ( double power_pct)
inline

Sets the percentage of the motor's total power that should be employed.

Parameters
power_pctPercentage of motor's power, between -1 and 1, where negative values indicate a backwards direction and positive values, a forward direction.

◆ set_power() [2/3]

void viam::sdk::impl::MotorClient::set_power ( double power_pct,
const ProtoStruct & extra )
overridevirtual

Sets the percentage of the motor's total power that should be employed.

Parameters
power_pctPercentage of motor's power, between -1 and 1, where negative values indicate a backwards direction and positive values, a forward direction.
extraAny additional arguments to the method.

Implements viam::sdk::Motor.

◆ set_power() [3/3]

virtual void viam::sdk::Motor::set_power ( double power_pct,
const ProtoStruct & extra )
virtual

Sets the percentage of the motor's total power that should be employed.

Parameters
power_pctPercentage of motor's power, between -1 and 1, where negative values indicate a backwards direction and positive values, a forward direction.
extraAny additional arguments to the method.

Implements viam::sdk::Motor.

◆ set_rpm() [1/3]

void viam::sdk::Motor::set_rpm ( double rpm)
inline

Move the motor indefinitely at a specified speed which is expressed in RPM.

Parameters
rpmSpeed of motor travel in rotations per minute
Exceptions
`Exception`if position reporting is not supported

◆ set_rpm() [2/3]

void viam::sdk::impl::MotorClient::set_rpm ( double rpm,
const ProtoStruct & extra )
overridevirtual

Move the motor indefinitely at a specified speed which is expressed in RPM.

Parameters
rpmSpeed of motor travel in rotations per minute
extraAny additional arguments to the method.
Exceptions
`Exception`if position reporting is not supported

Implements viam::sdk::Motor.

◆ set_rpm() [3/3]

virtual void viam::sdk::Motor::set_rpm ( double rpm,
const ProtoStruct & extra )
virtual

Move the motor indefinitely at a specified speed which is expressed in RPM.

Parameters
rpmSpeed of motor travel in rotations per minute
extraAny additional arguments to the method.
Exceptions
`Exception`if position reporting is not supported

Implements viam::sdk::Motor.

◆ stop()

void viam::sdk::impl::MotorClient::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: