6#include <grpcpp/channel.h>
8#include <viam/api/component/motor/v1/motor.grpc.pb.h>
12#include <viam/sdk/config/resource.hpp>
25 void set_power(
double power_pct,
const ProtoStruct& extra)
override;
26 void go_for(
double rpm,
double revolutions,
const ProtoStruct& extra)
override;
27 void go_to(
double rpm,
double position_revolutions,
const ProtoStruct& extra)
override;
28 void set_rpm(
double rpm,
const ProtoStruct& extra)
override;
32 void stop(
const ProtoStruct& extra)
override;
34 std::vector<GeometryConfig>
get_geometries(
const ProtoStruct& extra)
override;
36 ProtoStruct
do_command(
const ProtoStruct& command)
override;
59 using StubType = viam::component::motor::v1::MotorService::StubInterface;
60 std::unique_ptr<StubType> stub_;
61 std::shared_ptr<grpc::Channel> channel_;
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
void set_rpm(double rpm)
Move the motor indefinitely at a specified speed which is expressed in RPM.
Definition motor.hpp:102
std::vector< GeometryConfig > get_geometries()
Returns GeometryConfigs associated with the calling motor.
Definition motor.hpp:166
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
void reset_zero_position(double offset)
Sets the current position of the motor as the new zero position.
Definition motor.hpp:115
virtual std::string name() const
Return the resource's name.
void stop()
Stops a resource from running.
Definition stoppable.hpp:16
gRPC client implementation of a Motor component.
Definition motor_client.hpp:21
bool is_moving() override
Reports if a component is in motion.
void set_rpm(double rpm, const ProtoStruct &extra) override
Move the motor indefinitely at a specified speed which is expressed in RPM.
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 o...
void stop(const ProtoStruct &extra) override
Stops a resource from running.
position get_position(const ProtoStruct &extra) override
Reports the position of the robot's motor relative to its zero 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 whic...
std::vector< GeometryConfig > get_geometries(const ProtoStruct &extra) override
Returns GeometryConfigs associated with the calling motor.
ProtoStruct do_command(const ProtoStruct &command) override
Send/receive arbitrary commands to the resource.
power_status get_power_status(const ProtoStruct &extra) override
void set_power(double power_pct, const ProtoStruct &extra) override
Sets the percentage of the motor's total power that should be employed.
properties get_properties(const ProtoStruct &extra) override
Returns the properties of the motor which comprises the booleans indicating.
void reset_zero_position(double offset, const ProtoStruct &extra) override
Sets the current position of the motor as the new zero position.
Defines a Motor component.
Implements a gRPC server for the Motor component.
Current position of the motor relative to its home.
Information about power-state of the motor.
Definition motor.hpp:30
Features that the specific motor supports.
Definition motor.hpp:41