Viam C++ SDK current
Loading...
Searching...
No Matches
arm.hpp
Go to the documentation of this file.
1
4#pragma once
5
6#include <string>
7
8#include <boost/optional/optional.hpp>
9
10#include <viam/sdk/common/kinematics.hpp>
11#include <viam/sdk/common/mesh.hpp>
12#include <viam/sdk/common/pose.hpp>
13#include <viam/sdk/resource/stoppable.hpp>
14#include <viam/sdk/spatialmath/geometry.hpp>
15
16namespace viam {
17namespace sdk {
18
20
27class Arm : public Component, public Stoppable {
28 public:
31 [[deprecated("Use ::viam::sdk::KinematicsDataUnspecified instead")]] =
33 using KinematicsDataSVA [[deprecated("Use ::viam::sdk::KinematicsDataSVA instead")]] =
35 using KinematicsDataURDF [[deprecated("Use ::viam::sdk::KinematicsDataURDF instead")]] =
37 using KinematicsData [[deprecated("Use ::viam::sdk::KinematicsData instead")]] =
38 ::viam::sdk::KinematicsData;
39
41 struct MoveOptions {
42 boost::optional<double> max_vel_degs_per_sec;
43 boost::optional<double> max_acc_degs_per_sec2;
44 };
45
49 return get_end_position({});
50 }
51
55 virtual pose get_end_position(const ProtoStruct& extra) = 0;
56
58 inline void move_to_position(const pose& pose) {
60 }
61
65 virtual void move_to_position(const pose& pose, const ProtoStruct& extra) = 0;
66
68 inline std::vector<double> get_joint_positions() {
69 return get_joint_positions({});
70 }
71
74 virtual std::vector<double> get_joint_positions(const ProtoStruct& extra) = 0;
75
77 inline void move_to_joint_positions(const std::vector<double>& positions) {
78 return move_to_joint_positions(positions, {});
79 }
80
83 virtual void move_to_joint_positions(const std::vector<double>& positions,
84 const ProtoStruct& extra) = 0;
85
90 inline void move_through_joint_positions(const std::vector<std::vector<double>>& positions,
91 const MoveOptions& options) {
92 return move_through_joint_positions(positions, options, {});
93 }
94
98 virtual void move_through_joint_positions(const std::vector<std::vector<double>>& positions,
99 const MoveOptions& options,
100 const ProtoStruct& extra) = 0;
101
103 virtual bool is_moving() = 0;
104
108 virtual ProtoStruct do_command(const ProtoStruct& command) = 0;
109
114 virtual ::viam::sdk::KinematicsData get_kinematics(const ProtoStruct& extra) = 0;
115
119 inline ::viam::sdk::KinematicsData get_kinematics() {
120 return get_kinematics({});
121 }
122
126 virtual std::map<std::string, mesh> get_3d_models(const ProtoStruct& extra) = 0;
127
130 inline std::map<std::string, mesh> get_3d_models() {
131 return get_3d_models({});
132 }
133
135 inline std::vector<GeometryConfig> get_geometries() {
136 return get_geometries({});
137 }
138
141 virtual std::vector<GeometryConfig> get_geometries(const ProtoStruct& extra) = 0;
142
143 API api() const override;
144
145 protected:
146 explicit Arm(std::string name);
147};
148
149template <>
151 static API api();
152};
153
154} // namespace sdk
155} // namespace viam
Definition resource_api.hpp:21
An Arm represents a physical robot arm that exists in three-dimensional space.
Definition arm.hpp:27
virtual bool is_moving()=0
Reports if the arm is in motion.
virtual void move_through_joint_positions(const std::vector< std::vector< double > > &positions, const MoveOptions &options, const ProtoStruct &extra)=0
Move each joint on the arm through the positions specified in.
virtual void move_to_position(const pose &pose, const ProtoStruct &extra)=0
Move the end of the arm to.
virtual std::vector< double > get_joint_positions(const ProtoStruct &extra)=0
Lists the joint positions in degrees of every joint on a robot arm.
std::vector< double > get_joint_positions()
Lists the joint positions in degrees of every joint on a robot arm.
Definition arm.hpp:68
virtual ProtoStruct do_command(const ProtoStruct &command)=0
Send/receive arbitrary commands to the resource.
void move_to_joint_positions(const std::vector< double > &positions)
Move each joint on the arm to the corresponding angle specified in.
Definition arm.hpp:77
std::vector< GeometryConfig > get_geometries()
Returns GeometryConfigs associated with the calling arm.
Definition arm.hpp:135
inline ::viam::sdk::KinematicsData get_kinematics()
Get the kinematics data associated with the arm.
Definition arm.hpp:119
virtual std::map< std::string, mesh > get_3d_models(const ProtoStruct &extra)=0
Returns 3DModels associated with the calling arm.
virtual void move_to_joint_positions(const std::vector< double > &positions, const ProtoStruct &extra)=0
Move each joint on the arm to the corresponding angle specified in.
void move_through_joint_positions(const std::vector< std::vector< double > > &positions, const MoveOptions &options)
Move each joint on the arm through the positions specified in.
Definition arm.hpp:90
virtual::viam::sdk::KinematicsData get_kinematics(const ProtoStruct &extra)=0
Get the kinematics data associated with the arm.
std::map< std::string, mesh > get_3d_models()
Returns 3DModels associated with the calling arm.
Definition arm.hpp:130
pose get_end_position()
Get the current position of the end of the arm.
Definition arm.hpp:48
void move_to_position(const pose &pose)
Move the end of the arm to.
Definition arm.hpp:58
virtual std::vector< GeometryConfig > get_geometries(const ProtoStruct &extra)=0
Returns GeometryConfigs associated with the calling arm.
virtual pose get_end_position(const ProtoStruct &extra)=0
Get the current position of the end of the arm.
API api() const override
Returns the API associated with a particular resource.
Definition component.hpp:10
virtual std::string name() const
Return the resource's name.
Definition stoppable.hpp:8
Definition resource_api.hpp:46
Movement specifications for move_through_join_positions.
Definition arm.hpp:41
Kinematics data in Viam's Spatial Vector Algebra (SVA) format.
Definition kinematics.hpp:45
Kinematics data in URDF format.
Definition kinematics.hpp:50
Kinematics data with unspecified format.
Definition kinematics.hpp:42
Definition pose.hpp:30