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#include <vector>
8
9#include <boost/optional/optional.hpp>
10#include <boost/variant/variant.hpp>
11
12#include <viam/sdk/common/kinematics.hpp>
13#include <viam/sdk/common/mesh.hpp>
14#include <viam/sdk/common/pose.hpp>
15#include <viam/sdk/resource/stoppable.hpp>
16#include <viam/sdk/spatialmath/geometry.hpp>
17
18namespace viam {
19namespace sdk {
20
22
29class Arm : public Component, public Stoppable {
30 public:
33 [[deprecated("Use ::viam::sdk::KinematicsDataUnspecified instead")]] =
35 using KinematicsDataSVA [[deprecated("Use ::viam::sdk::KinematicsDataSVA instead")]] =
37 using KinematicsDataURDF [[deprecated("Use ::viam::sdk::KinematicsDataURDF instead")]] =
39 using KinematicsData [[deprecated("Use ::viam::sdk::KinematicsData instead")]] =
40 ::viam::sdk::KinematicsData;
41
43 using MoveLimit = boost::variant<double, std::vector<double>>;
44
46 struct MoveOptions {
47 boost::optional<MoveLimit> max_vel_degs_per_sec;
48 boost::optional<MoveLimit> max_acc_degs_per_sec2;
49 boost::optional<double> max_tcp_speed;
50 };
51
55 return get_end_position({});
56 }
57
61 virtual pose get_end_position(const ProtoStruct& extra) = 0;
62
64 inline void move_to_position(const pose& pose) {
66 }
67
71 virtual void move_to_position(const pose& pose, const ProtoStruct& extra) = 0;
72
74 inline std::vector<double> get_joint_positions() {
75 return get_joint_positions({});
76 }
77
80 virtual std::vector<double> get_joint_positions(const ProtoStruct& extra) = 0;
81
83 inline void move_to_joint_positions(const std::vector<double>& positions) {
84 return move_to_joint_positions(positions, {});
85 }
86
89 virtual void move_to_joint_positions(const std::vector<double>& positions,
90 const ProtoStruct& extra) = 0;
91
96 inline void move_through_joint_positions(const std::vector<std::vector<double>>& positions,
97 const MoveOptions& options) {
98 return move_through_joint_positions(positions, options, {});
99 }
100
104 virtual void move_through_joint_positions(const std::vector<std::vector<double>>& positions,
105 const MoveOptions& options,
106 const ProtoStruct& extra) = 0;
107
109 virtual bool is_moving() = 0;
110
113 virtual ProtoStruct get_status() = 0;
114
118 virtual ProtoStruct do_command(const ProtoStruct& command) = 0;
119
123 virtual ::viam::sdk::KinematicsData get_kinematics(const ProtoStruct& extra) = 0;
124
127 inline ::viam::sdk::KinematicsData get_kinematics() {
128 return get_kinematics({});
129 }
130
134 virtual std::map<std::string, mesh> get_3d_models(const ProtoStruct& extra) = 0;
135
138 inline std::map<std::string, mesh> get_3d_models() {
139 return get_3d_models({});
140 }
141
143 inline std::vector<GeometryConfig> get_geometries() {
144 return get_geometries({});
145 }
146
149 virtual std::vector<GeometryConfig> get_geometries(const ProtoStruct& extra) = 0;
150
151 API api() const override;
152
153 protected:
154 explicit Arm(std::string name);
155};
156
157template <>
159 static API api();
160};
161
162} // namespace sdk
163} // namespace viam
Definition resource_api.hpp:21
An Arm represents a physical robot arm that exists in three-dimensional space.
Definition arm.hpp:29
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:74
virtual ProtoStruct get_status()=0
Get the status of the arm.
virtual ProtoStruct do_command(const ProtoStruct &command)=0
Send/receive arbitrary commands to the resource.
boost::variant< double, std::vector< double > > MoveLimit
A movement limit: either a single scalar applied uniformly, or per-joint values.
Definition arm.hpp:43
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:83
std::vector< GeometryConfig > get_geometries()
Returns GeometryConfigs associated with the calling arm.
Definition arm.hpp:143
inline ::viam::sdk::KinematicsData get_kinematics()
Get the kinematics data associated with the arm.
Definition arm.hpp:127
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:96
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:138
pose get_end_position()
Get the current position of the end of the arm.
Definition arm.hpp:54
void move_to_position(const pose &pose)
Move the end of the arm to.
Definition arm.hpp:64
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_joint_positions.
Definition arm.hpp:46
Kinematics data in Viam's Spatial Vector Algebra (SVA) format.
Definition kinematics.hpp:48
Kinematics data in URDF format with optional meshes by URDF filepath.
Definition kinematics.hpp:53
Kinematics data with unspecified format.
Definition kinematics.hpp:45
Definition pose.hpp:30