Viam C++ SDK current
|
A Motor
represents physical hardware that controls the rotation of an axle.
More...
#include "components/motor.hpp"
Classes | |
struct | power_status |
Information about power-state of the motor. More... | |
struct | properties |
Features that the specific motor supports. More... | |
Public Types | |
typedef double | position |
Public Member Functions | |
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 | 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 | 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. | |
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. | |
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. | |
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. | |
power_status | get_power_status () |
virtual power_status | get_power_status (const ProtoStruct &extra)=0 |
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< GeometryConfig > | get_geometries () |
Returns GeometryConfig s associated with the calling motor. | |
virtual std::vector< GeometryConfig > | get_geometries (const ProtoStruct &extra)=0 |
Returns GeometryConfig s 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 | |
virtual void | stop (const ProtoStruct &extra)=0 |
Stops a resource from running. | |
void | stop () |
Stops a resource from running. | |
Protected Member Functions | |
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 |
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. | |
A Motor
represents physical hardware that controls the rotation of an axle.
This acts as an abstract base class to be inherited from by any drivers representing specific motor implementations. This class cannot be used on its own.
|
overridevirtual |
Returns the API
associated with a particular resource.
Implements viam::sdk::Resource.
|
pure virtual |
Send/receive arbitrary commands to the resource.
Command | the command to execute. |
Implemented in viam::sdk::impl::MotorClient.
|
inline |
Returns GeometryConfig
s associated with the calling motor.
GeometryConfig
s associated with the component.
|
pure virtual |
Returns GeometryConfig
s associated with the calling motor.
extra | Any additional arguments to the method. |
GeometryConfig
s associated with the component. Implemented in viam::sdk::impl::MotorClient, and viam::sdk::impl::MotorClient.
|
inline |
Reports the position of the robot's motor relative to its zero position.
`Exception` | if position reporting is not supported |
|
pure virtual |
Reports the position of the robot's motor relative to its zero position.
extra | Any additional arguments to the method |
`Exception` | if position reporting is not supported |
Implemented in viam::sdk::impl::MotorClient, and viam::sdk::impl::MotorClient.
|
inline |
|
pure virtual |
extra | Any additional arguments to the method |
Implemented in viam::sdk::impl::MotorClient, and viam::sdk::impl::MotorClient.
|
pure virtual |
Returns the properties of the motor which comprises the booleans indicating.
extra | Any additional arguments to the method which optional features the robot's motor supports |
Implemented in viam::sdk::impl::MotorClient, and viam::sdk::impl::MotorClient.
|
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.
rpm | Speed of motor travel in rotations per minute |
revolutions | Number 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. |
`Exception` | if position reporting is not supported |
|
pure 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.
rpm | Speed of motor travel in rotations per minute |
revolutions | Number 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. |
extra | Any additional arguments to the method. |
`Exception` | if position reporting is not supported |
Implemented in viam::sdk::impl::MotorClient, and viam::sdk::impl::MotorClient.
|
inline |
Move the motor to a specific position that is relative to its home position at a specified speed which is expressed in RPM.
rpm | Speed of motor travel in rotations per minute |
position_revolutions | Number of revolutions relative to motor's home home/zero |
`Exception` | if position reporting is not supported |
|
pure virtual |
Move the motor to a specific position that is relative to its home position at a specified speed which is expressed in RPM.
rpm | Speed of motor travel in rotations per minute |
position_revolutions | Number of revolutions relative to motor's home home/zero |
extra | Any additional arguments to the method. |
`Exception` | if position reporting is not supported |
Implemented in viam::sdk::impl::MotorClient, and viam::sdk::impl::MotorClient.
|
pure virtual |
Reports if a component is in motion.
Implemented in viam::sdk::impl::MotorClient.
|
inline |
Sets the current position of the motor as the new zero position.
offset | Motor position |
`Exception` | if position reporting is not supported |
|
pure virtual |
Sets the current position of the motor as the new zero position.
offset | Motor position |
extra | Any additional arguments to the method |
`Exception` | if position reporting is not supported |
Implemented in viam::sdk::impl::MotorClient, and viam::sdk::impl::MotorClient.
|
inline |
Sets the percentage of the motor's total power that should be employed.
power_pct | Percentage of motor's power, between -1 and 1, where negative values indicate a backwards direction and positive values, a forward direction. |
|
pure virtual |
Sets the percentage of the motor's total power that should be employed.
power_pct | Percentage of motor's power, between -1 and 1, where negative values indicate a backwards direction and positive values, a forward direction. |
extra | Any additional arguments to the method. |
Implemented in viam::sdk::impl::MotorClient, and viam::sdk::impl::MotorClient.
|
inline |
Move the motor indefinitely at a specified speed which is expressed in RPM.
rpm | Speed of motor travel in rotations per minute |
`Exception` | if position reporting is not supported |
|
pure virtual |
Move the motor indefinitely at a specified speed which is expressed in RPM.
rpm | Speed of motor travel in rotations per minute |
extra | Any additional arguments to the method. |
`Exception` | if position reporting is not supported |
Implemented in viam::sdk::impl::MotorClient, and viam::sdk::impl::MotorClient.