Viam C++ SDK current
Loading...
Searching...
No Matches
gantry.hpp
Go to the documentation of this file.
1
4#pragma once
5
6#include <viam/api/common/v1/common.pb.h>
7#include <viam/api/component/gantry/v1/gantry.pb.h>
8
9#include <viam/sdk/resource/stoppable.hpp>
10
11namespace viam {
12namespace sdk {
13
15
23class Gantry : public Component, public Stoppable {
24 public:
31
35 };
36
38 inline std::vector<double> get_position() {
39 return get_position({});
40 }
41
44 virtual std::vector<double> get_position(const AttributeMap& extra) = 0;
45
50 inline void move_to_position(const std::vector<movement_coordinate>& coordinates) {
52 }
53
59 virtual void move_to_position(const std::vector<movement_coordinate>& coordinates,
60 const AttributeMap& extra) = 0;
61
65 inline bool home() {
66 return home({});
67 }
68
73 virtual bool home(const AttributeMap& extra) = 0;
74
76 inline std::vector<double> get_lengths() {
77 return get_lengths({});
78 }
79
82 virtual std::vector<double> get_lengths(const AttributeMap& extra) = 0;
83
85 virtual bool is_moving() = 0;
86
90 virtual AttributeMap do_command(const AttributeMap& command) = 0;
91
93 inline std::vector<GeometryConfig> get_geometries() {
94 return get_geometries({});
95 }
96
99 virtual std::vector<GeometryConfig> get_geometries(const AttributeMap& extra) = 0;
100
101 API api() const override;
102
103 protected:
104 using Component::Component;
105};
106
107template <>
109 static API api();
110};
111
112} // namespace sdk
113} // namespace viam
Extends APIType to additionally define a resource's subtype (e.g., camera).
Definition resource_api.hpp:33
Definition component.hpp:14
A Gantry represents a physical gantry and can be used for controlling gantries of N axes.
Definition gantry.hpp:23
virtual AttributeMap do_command(const AttributeMap &command)=0
Send/receive arbitrary commands to the resource.
std::vector< double > get_position()
Get the positions of the axes of the gantry in millimeters.
Definition gantry.hpp:38
virtual bool is_moving()=0
Reports if the gantry is in motion.
virtual bool home(const AttributeMap &extra)=0
Run the homing sequence of the gantry to re-calibrate the axes with respect to the limit switches.
bool home()
Run the homing sequence of the gantry to re-calibrate the axes with respect to the limit switches.
Definition gantry.hpp:65
virtual std::vector< double > get_position(const AttributeMap &extra)=0
Get the positions of the axes of the gantry in millimeters.
void move_to_position(const std::vector< movement_coordinate > &coordinates)
Move the axes of the gantry to the desired positions (mm) at the requested speeds (mm/sec).
Definition gantry.hpp:50
virtual void move_to_position(const std::vector< movement_coordinate > &coordinates, const AttributeMap &extra)=0
Move the axes of the gantry to the desired positions (mm) at the requested speeds (mm/sec).
std::vector< double > get_lengths()
Get the lengths of the axes of the gantry in millimeters.
Definition gantry.hpp:76
virtual std::vector< GeometryConfig > get_geometries(const AttributeMap &extra)=0
Returns GeometryConfigs associated with the calling gantry.
API api() const override
Returns the API associated with a particular resource.
virtual std::vector< double > get_lengths(const AttributeMap &extra)=0
Get the lengths of the axes of the gantry in millimeters.
std::vector< GeometryConfig > get_geometries()
Returns GeometryConfigs associated with the calling gantry.
Definition gantry.hpp:93
Definition stoppable.hpp:8
Definition resource_api.hpp:50
A coordinate for moving a single axis of a gantry to a desired position at a requested speed.
Definition gantry.hpp:28
double speed_mm_per_sec
A speed in millimeters per second for the gantry to move at respective to the axis.
Definition gantry.hpp:34
double position_mm
A position for the axis of the gantry to move to, in millimeters.
Definition gantry.hpp:30
Definition pose.hpp:8