8#include <viam/sdk/common/proto_value.hpp>
9#include <viam/sdk/common/utils.hpp>
10#include <viam/sdk/config/resource.hpp>
11#include <viam/sdk/resource/stoppable.hpp>
57 virtual void set_power(
double power_pct,
const ProtoStruct& extra) = 0;
67 inline void go_for(
double rpm,
double revolutions) {
68 return go_for(rpm, revolutions, {});
80 virtual void go_for(
double rpm,
double revolutions,
const ProtoStruct& extra) = 0;
87 inline void go_to(
double rpm,
double position_revolutions) {
88 return go_to(rpm, position_revolutions, {});
97 virtual void go_to(
double rpm,
double position_revolutions,
const ProtoStruct& extra) = 0;
110 virtual void set_rpm(
double rpm,
const ProtoStruct& extra) = 0;
162 virtual ProtoStruct
do_command(
const ProtoStruct& command) = 0;
173 virtual std::vector<GeometryConfig>
get_geometries(
const ProtoStruct& extra) = 0;
Extends APIType to additionally define a resource's subtype (e.g., camera).
Definition resource_api.hpp:33
Definition component.hpp:10
A Motor represents physical hardware that controls the rotation of an axle.
Definition motor.hpp:22
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 whic...
Definition motor.hpp:87
position get_position()
Reports the position of the robot's motor relative to its zero position.
Definition motor.hpp:127
void set_power(double power_pct)
Sets the percentage of the motor's total power that should be employed.
Definition motor.hpp:49
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 o...
virtual std::vector< GeometryConfig > get_geometries(const ProtoStruct &extra)=0
Returns GeometryConfigs associated with the calling motor.
void set_rpm(double rpm)
Move the motor indefinitely at a specified speed which is expressed in RPM.
Definition motor.hpp:102
virtual void reset_zero_position(double offset, const ProtoStruct &extra)=0
Sets the current position of the motor as the new zero position.
std::vector< GeometryConfig > get_geometries()
Returns GeometryConfigs associated with the calling motor.
Definition motor.hpp:166
virtual void set_rpm(double rpm, const ProtoStruct &extra)=0
Move the motor indefinitely at a specified speed which is expressed in RPM.
virtual properties get_properties(const ProtoStruct &extra)=0
Returns the properties of the motor which comprises the booleans indicating.
virtual position get_position(const ProtoStruct &extra)=0
Reports the position of the robot's motor relative to its zero position.
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 o...
Definition motor.hpp:67
properties get_properties()
Returns the properties of the motor which comprises the booleans indicating which optional features t...
Definition motor.hpp:138
power_status get_power_status()
Definition motor.hpp:148
virtual void set_power(double power_pct, const ProtoStruct &extra)=0
Sets the percentage of the motor's total power that should be employed.
virtual ProtoStruct do_command(const ProtoStruct &command)=0
Send/receive arbitrary commands to the resource.
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 whic...
void reset_zero_position(double offset)
Sets the current position of the motor as the new zero position.
Definition motor.hpp:115
virtual power_status get_power_status(const ProtoStruct &extra)=0
virtual bool is_moving()=0
Reports if a component is in motion.
API api() const override
Returns the API associated with a particular resource.
virtual std::string name() const
Return the resource's name.
Definition stoppable.hpp:8
Current position of the motor relative to its home.
Definition resource_api.hpp:50
Information about power-state of the motor.
Definition motor.hpp:30
bool is_on
True if the motor is on.
Definition motor.hpp:32
double power_pct
Definition motor.hpp:36
Features that the specific motor supports.
Definition motor.hpp:41
bool position_reporting
True if the motor supports reporting its position.
Definition motor.hpp:43