Viam C++ SDK current
Loading...
Searching...
No Matches
gantry.hpp
Go to the documentation of this file.
1
4#pragma once
5
7#include <viam/sdk/resource/stoppable.hpp>
8
9namespace viam {
10namespace sdk {
11
13
21class Gantry : public Component, public Stoppable {
22 public:
28 double position_mm = 0.0;
29
32 double speed_mm_per_sec = 0.0;
33 };
34
36 inline std::vector<double> get_position() {
37 return get_position({});
38 }
39
42 virtual std::vector<double> get_position(const ProtoStruct& extra) = 0;
43
48 inline void move_to_position(const std::vector<movement_coordinate>& coordinates) {
50 }
51
57 virtual void move_to_position(const std::vector<movement_coordinate>& coordinates,
58 const ProtoStruct& extra) = 0;
59
63 inline bool home() {
64 return home({});
65 }
66
71 virtual bool home(const ProtoStruct& extra) = 0;
72
74 inline std::vector<double> get_lengths() {
75 return get_lengths({});
76 }
77
80 virtual std::vector<double> get_lengths(const ProtoStruct& extra) = 0;
81
83 virtual bool is_moving() = 0;
84
87 virtual ProtoStruct get_status() = 0;
88
92 virtual ProtoStruct do_command(const ProtoStruct& command) = 0;
93
95 inline std::vector<GeometryConfig> get_geometries() {
96 return get_geometries({});
97 }
98
101 virtual std::vector<GeometryConfig> get_geometries(const ProtoStruct& extra) = 0;
102
108 const ProtoStruct& extra) = 0;
109
114 return get_kinematic_model(options, {});
115 }
116
117#pragma GCC diagnostic push
118#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
123 [[deprecated("use get_kinematic_model")]] virtual KinematicsData get_kinematics(
124 const ProtoStruct& extra);
125
128 [[deprecated("use get_kinematic_model")]] KinematicsData get_kinematics();
129#pragma GCC diagnostic pop
130
131 API api() const override;
132
133 protected:
134 using Component::Component;
135};
136
137template <>
139 static API api();
140};
141
142} // namespace sdk
143} // namespace viam
Definition resource_api.hpp:21
Definition component.hpp:10
A Gantry represents a physical gantry and can be used for controlling gantries of N axes.
Definition gantry.hpp:21
virtual KinematicModel get_kinematic_model(const kinematics_options &options, const ProtoStruct &extra)=0
Get the kinematic model of the gantry.
virtual void move_to_position(const std::vector< movement_coordinate > &coordinates, const ProtoStruct &extra)=0
Move the axes of the gantry to the desired positions (mm) at the requested speeds (mm/sec).
KinematicModel get_kinematic_model(const kinematics_options &options={})
Get the kinematic model of the gantry.
Definition gantry.hpp:113
virtual ProtoStruct do_command(const ProtoStruct &command)=0
Send/receive arbitrary commands to the resource.
virtual bool home(const ProtoStruct &extra)=0
Run the homing sequence of the gantry to re-calibrate the axes with respect to the limit switches.
std::vector< double > get_position()
Get the positions of the axes of the gantry in millimeters.
Definition gantry.hpp:36
virtual bool is_moving()=0
Reports if the gantry is in motion.
bool home()
Run the homing sequence of the gantry to re-calibrate the axes with respect to the limit switches.
Definition gantry.hpp:63
virtual std::vector< double > get_position(const ProtoStruct &extra)=0
Get the positions of the axes of the gantry in millimeters.
virtual std::vector< GeometryConfig > get_geometries(const ProtoStruct &extra)=0
Returns GeometryConfigs associated with the calling gantry.
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:48
KinematicsData get_kinematics()
Get the kinematics data associated with the gantry as a raw file.
std::vector< double > get_lengths()
Get the lengths of the axes of the gantry in millimeters.
Definition gantry.hpp:74
virtual ProtoStruct get_status()=0
Get the status of the gantry.
virtual std::vector< double > get_lengths(const ProtoStruct &extra)=0
Get the lengths of the axes of the gantry in millimeters.
virtual KinematicsData get_kinematics(const ProtoStruct &extra)
Get the kinematics data associated with the gantry as a raw file.
API api() const override
Returns the API associated with a particular resource.
std::vector< GeometryConfig > get_geometries()
Returns GeometryConfigs associated with the calling gantry.
Definition gantry.hpp:95
Definition stoppable.hpp:8
Kinematics data types shared by the components that serve GetKinematics.
Definition resource_api.hpp:46
A coordinate for moving a single axis of a gantry to a desired position at a requested speed.
Definition gantry.hpp:26
double speed_mm_per_sec
A speed in millimeters per second for the gantry to move at respective to the axis.
Definition gantry.hpp:32
double position_mm
A position for the axis of the gantry to move to, in millimeters.
Definition gantry.hpp:28
A component's kinematics as a tree of links and joints. Its proto JSON encoding is also the on-disk k...
Definition kinematics.hpp:154
Definition pose.hpp:20
Options for a GetKinematics request.
Definition kinematics.hpp:39