15#include <viam/sdk/common/mesh.hpp>
16#include <viam/sdk/common/pose.hpp>
17#include <viam/sdk/common/proto_convert.hpp>
18#include <viam/sdk/resource/stoppable.hpp>
19#include <viam/sdk/spatialmath/geometry.hpp>
27class MoveThroughJointPositionsStreamedResponse;
28class GetPropertiesResponse;
50 [[deprecated(
"Use ::viam::sdk::KinematicsDataUnspecified instead")]] =
52 using KinematicsDataSVA [[deprecated(
"Use ::viam::sdk::KinematicsDataSVA instead")]] =
54 using KinematicsDataURDF [[deprecated(
"Use ::viam::sdk::KinematicsDataURDF instead")]] =
56#pragma GCC diagnostic push
57#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
58 using KinematicsData [[deprecated(
"Use ::viam::sdk::KinematicsData instead")]] =
59 ::viam::sdk::KinematicsData;
60#pragma GCC diagnostic pop
63 using MoveLimit = std::variant<double, std::vector<double>>;
67 std::optional<MoveLimit> max_vel_degs_per_sec;
68 std::optional<MoveLimit> max_acc_degs_per_sec2;
69 std::optional<double> max_tcp_speed;
120 const ProtoStruct& extra) = 0;
136 const ProtoStruct& extra) = 0;
151 std::vector<double> velocities_degs_per_sec;
152 std::optional<std::vector<double>> accelerations_degs_per_sec2;
161 std::chrono::microseconds
time;
187 const std::function<std::optional<std::vector<trajectory_point>>()>& batch_source,
233 const std::function<std::optional<std::vector<trajectory_point>>()>& batch_source,
235 const ProtoStruct& extra) = 0;
247 virtual ProtoStruct
do_command(
const ProtoStruct& command) = 0;
254 const ProtoStruct& extra) = 0;
263#pragma GCC diagnostic push
264#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
270 const ProtoStruct& extra);
275#pragma GCC diagnostic pop
280 virtual std::map<std::string, mesh>
get_3d_models(
const ProtoStruct& extra) = 0;
295 virtual std::vector<GeometryConfig>
get_geometries(
const ProtoStruct& extra) = 0;
329 std::chrono::seconds enabled_for,
330 const ProtoStruct& extra) = 0;
346 explicit Arm(std::string
name);
356namespace proto_convert_details {
371 viam::component::arm::v1::MoveThroughJointPositionsStreamedResponse*)
const;
375struct from_proto_impl<viam::component::arm::v1::MoveThroughJointPositionsStreamedResponse> {
377 const viam::component::arm::v1::MoveThroughJointPositionsStreamedResponse*)
const;
382 void operator()(
const Arm::properties&, viam::component::arm::v1::GetPropertiesResponse*)
const;
387 Arm::properties operator()(
const viam::component::arm::v1::GetPropertiesResponse*)
const;
Definition resource_api.hpp:21
An Arm represents a physical robot arm that exists in three-dimensional space.
Definition arm.hpp:46
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.
bool get_manual_mode()
Reports whether the arm is currently in manual mode.
Definition arm.hpp:334
KinematicsData get_kinematics()
Get the kinematics data associated with the arm as a raw file.
std::vector< double > get_joint_positions()
Lists the joint positions in degrees of every joint on a robot arm.
Definition arm.hpp:104
virtual ProtoStruct get_status()=0
Get the status of the arm.
stream_outcome move_through_joint_positions_streamed(const std::function< std::optional< std::vector< trajectory_point > >()> &batch_source, const std::function< bool(trajectory_update)> &update_handler)
Execute a stream of trajectory points in order.
Definition arm.hpp:186
stream_outcome
How a streamed trajectory execution ended.
Definition arm.hpp:176
@ k_halted_by_update_handler
update_handler returned false, stopping the stream early.
@ k_completed
The trajectory ran to its natural end.
virtual ProtoStruct do_command(const ProtoStruct &command)=0
Send/receive arbitrary commands to the resource.
virtual KinematicModel get_kinematic_model(const kinematics_options &options, const ProtoStruct &extra)=0
Get the kinematic model of the arm.
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:113
std::vector< GeometryConfig > get_geometries()
Returns GeometryConfigs associated with the calling arm.
Definition arm.hpp:289
void set_manual_mode(bool manual_mode)
Enter or exit manual mode, with no time limit.
Definition arm.hpp:311
virtual std::map< std::string, mesh > get_3d_models(const ProtoStruct &extra)=0
Returns 3DModels associated with the calling arm.
std::variant< double, std::vector< double > > MoveLimit
A movement limit: either a single scalar applied uniformly, or per-joint values.
Definition arm.hpp:63
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:126
virtual KinematicsData get_kinematics(const ProtoStruct &extra)
Get the kinematics data associated with the arm as a raw file.
std::map< std::string, mesh > get_3d_models()
Returns 3DModels associated with the calling arm.
Definition arm.hpp:284
KinematicModel get_kinematic_model(const kinematics_options &options={})
Get the kinematic model of the arm.
Definition arm.hpp:259
properties get_properties()
Returns the properties of the arm which comprises the booleans indicating which optional features the...
Definition arm.hpp:299
virtual stream_outcome move_through_joint_positions_streamed(const std::function< std::optional< std::vector< trajectory_point > >()> &batch_source, const std::function< bool(trajectory_update)> &update_handler, const ProtoStruct &extra)=0
Execute a stream of trajectory points in order.
virtual void set_manual_mode(bool manual_mode, std::chrono::seconds enabled_for, const ProtoStruct &extra)=0
Enter or exit manual mode.
virtual bool get_manual_mode(const ProtoStruct &extra)=0
Reports whether the arm is currently in manual mode.
pose get_end_position()
Get the current position of the end of the arm.
Definition arm.hpp:84
void move_to_position(const pose &pose)
Move the end of the arm to.
Definition arm.hpp:94
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.
virtual properties get_properties(const ProtoStruct &extra)=0
Returns the properties of the arm which comprises the booleans indicating which optional features the...
API api() const override
Returns the API associated with a particular resource.
void set_manual_mode(bool manual_mode, std::chrono::seconds enabled_for)
Enter or exit manual mode.
Definition arm.hpp:319
Definition component.hpp:10
Definition resource.hpp:42
virtual std::string name() const
Return the resource's name.
Definition stoppable.hpp:8
Kinematics data types shared by the components that serve GetKinematics.
Definition resource_api.hpp:46
Movement specifications for move_through_joint_positions.
Definition arm.hpp:66
Optional features that the specific arm supports.
Definition arm.hpp:74
bool support_cartesian_commands
True if the arm supports direct cartesian commands (move_to_position is implemented)
Definition arm.hpp:78
bool support_manual_mode
True if the arm supports software-enabled manual mode.
Definition arm.hpp:76
Target kinematic constraints at a waypoint.
Definition arm.hpp:150
A single waypoint in a streamed joint-space trajectory.
Definition arm.hpp:142
std::chrono::microseconds time
Offset of this waypoint from the start of the trajectory.
Definition arm.hpp:161
std::optional< kinematic_constraints > constraints
Optional velocity and acceleration constraints at this waypoint.
Definition arm.hpp:167
std::vector< double > positions
Target position at this waypoint, one value per joint, in degrees.
Definition arm.hpp:164
An update emitted while a streamed trajectory executes.
Definition arm.hpp:173
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
Kinematics data in Viam's Spatial Vector Algebra (SVA) format.
Definition kinematics.hpp:195
Kinematics data in URDF format with optional meshes by URDF filepath.
Definition kinematics.hpp:200
Kinematics data with unspecified format.
Definition kinematics.hpp:192
Options for a GetKinematics request.
Definition kinematics.hpp:39
Definition proto_convert.hpp:24
Definition proto_convert.hpp:18