6#include <viam/api/component/servo/v1/servo.pb.h>
8#include <viam/sdk/common/proto_type.hpp>
9#include <viam/sdk/common/utils.hpp>
10#include <viam/sdk/config/resource.hpp>
11#include <viam/sdk/resource/stoppable.hpp>
36 inline void move(uint32_t angle_deg) {
37 return move(angle_deg, {});
43 virtual void move(uint32_t angle_deg,
const AttributeMap& extra) = 0;
62 virtual AttributeMap
do_command(
const AttributeMap& command) = 0;
73 virtual std::vector<GeometryConfig>
get_geometries(
const AttributeMap& extra) = 0;
Extends APIType to additionally define a resource's subtype (e.g., camera).
Definition resource_api.hpp:33
Definition component.hpp:14
virtual std::string name() const
Return the resource's name.
virtual position get_position(const AttributeMap &extra)=0
Reports the position of the robot's servo relative to its zero position.
virtual void move(uint32_t angle_deg, const AttributeMap &extra)=0
Move the servo to the provided angle.
API api() const override
Returns the API associated with a particular resource.
std::vector< GeometryConfig > get_geometries()
Returns GeometryConfigs associated with the calling servo.
Definition servo.hpp:66
static position from_proto(const viam::component::servo::v1::GetPositionResponse &proto)
Creates a position struct from its proto representation.
void move(uint32_t angle_deg)
Move the servo to the provided angle.
Definition servo.hpp:36
virtual AttributeMap do_command(const AttributeMap &command)=0
Send/receive arbitrary commands to the resource.
virtual std::vector< GeometryConfig > get_geometries(const AttributeMap &extra)=0
Returns GeometryConfigs associated with the calling servo.
virtual bool is_moving()=0
Reports if a component is in motion.
position get_position()
Get the current angle (degrees) of the servo.
Definition servo.hpp:47
Definition stoppable.hpp:8
Current position of the motor relative to its home.
Definition resource_api.hpp:50