Viam C++ SDK current
Loading...
Searching...
No Matches
arm_client.hpp
Go to the documentation of this file.
1
4#pragma once
5
6#include <viam/api/component/arm/v1/arm.grpc.pb.h>
7
9#include <viam/sdk/rpc/dial.hpp>
10
11namespace viam {
12namespace sdk {
13namespace impl {
14
18class ArmClient : public Arm {
19 public:
20 using interface_type = Arm;
21 ArmClient(std::string name, const ViamChannel& channel);
22
23 const ViamChannel& channel() const {
24 return *channel_;
25 }
26
27 pose get_end_position(const ProtoStruct& extra) override;
28 void move_to_position(const pose& pose, const ProtoStruct& extra) override;
29 std::vector<double> get_joint_positions(const ProtoStruct& extra) override;
30 void move_to_joint_positions(const std::vector<double>& positions,
31 const ProtoStruct& extra) override;
32 void move_through_joint_positions(const std::vector<std::vector<double>>& positions,
33 const Arm::MoveOptions& options,
34 const ProtoStruct& extra) override;
35 Arm::stream_outcome move_through_joint_positions_streamed(
36 const std::function<std::optional<std::vector<Arm::trajectory_point>>()>& batch_source,
37 const std::function<bool(Arm::trajectory_update)>& update_handler,
38 const ProtoStruct& extra) override;
39 bool is_moving() override;
40 ProtoStruct get_status() override;
41 void stop(const ProtoStruct& extra) override;
42 ProtoStruct do_command(const ProtoStruct& command) override;
44 const ProtoStruct& extra) override;
45// Overriding the deprecated raw-bytes accessor keeps older servers readable.
46#pragma GCC diagnostic push
47#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
48 KinematicsData get_kinematics(const ProtoStruct& extra) override;
49#pragma GCC diagnostic pop
50 std::map<std::string, mesh> get_3d_models(const ProtoStruct& extra) override;
51 std::vector<GeometryConfig> get_geometries(const ProtoStruct& extra) override;
52 Arm::properties get_properties(const ProtoStruct& extra) override;
53 void set_manual_mode(bool manual_mode,
54 std::chrono::seconds enabled_for,
55 const ProtoStruct& extra) override;
56 bool get_manual_mode(const ProtoStruct& extra) override;
57
58 // Using declarations to introduce convenience overloads of interface which do not need to be
59 // passed the ProtoStruct parameter.
72 using Arm::stop;
73
74 private:
75 using StubType = viam::component::arm::v1::ArmService::StubInterface;
76 std::unique_ptr<StubType> stub_;
77 const ViamChannel* channel_;
78};
79
80} // namespace impl
81} // namespace sdk
82} // namespace viam
Defines an Arm component.
An Arm represents a physical robot arm that exists in three-dimensional space.
Definition arm.hpp:46
bool get_manual_mode()
Reports whether the arm is currently in manual mode.
Definition arm.hpp:334
std::vector< double > get_joint_positions()
Lists the joint positions in degrees of every joint on a robot arm.
Definition arm.hpp:104
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
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
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
std::map< std::string, mesh > get_3d_models()
Returns 3DModels associated with the calling arm.
Definition arm.hpp:284
properties get_properties()
Returns the properties of the arm which comprises the booleans indicating which optional features the...
Definition arm.hpp:299
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::string name() const
Return the resource's name.
void stop()
Stops a resource from running.
Definition stoppable.hpp:16
Definition dial.hpp:24
gRPC client implementation of an Arm component.
Definition arm_client.hpp:18
bool get_manual_mode(const ProtoStruct &extra) override
Reports whether the arm is currently in manual mode.
pose get_end_position(const ProtoStruct &extra) override
Get the current position of the end of the arm.
std::map< std::string, mesh > get_3d_models(const ProtoStruct &extra) override
Returns 3DModels associated with the calling arm.
ProtoStruct get_status() override
Get the status of the arm.
KinematicsData get_kinematics(const ProtoStruct &extra) override
Get the kinematics data associated with the arm as a raw file.
bool is_moving() override
Reports if the arm is in motion.
std::vector< double > get_joint_positions(const ProtoStruct &extra) override
Lists the joint positions in degrees of every joint on a robot arm.
void move_to_joint_positions(const std::vector< double > &positions, const ProtoStruct &extra) override
Move each joint on the arm to the corresponding angle specified in.
void set_manual_mode(bool manual_mode, std::chrono::seconds enabled_for, const ProtoStruct &extra) override
Enter or exit manual mode.
Arm::properties get_properties(const ProtoStruct &extra) override
Returns the properties of the arm which comprises the booleans indicating which optional features the...
ProtoStruct do_command(const ProtoStruct &command) override
Send/receive arbitrary commands to the resource.
void move_to_position(const pose &pose, const ProtoStruct &extra) override
Move the end of the arm to.
KinematicModel get_kinematic_model(const kinematics_options &options, const ProtoStruct &extra) override
Get the kinematic model of the arm.
void stop(const ProtoStruct &extra) override
Stops a resource from running.
std::vector< GeometryConfig > get_geometries(const ProtoStruct &extra) override
Returns GeometryConfigs associated with the calling arm.
void move_through_joint_positions(const std::vector< std::vector< double > > &positions, const Arm::MoveOptions &options, const ProtoStruct &extra) override
Move each joint on the arm through the positions specified in.
Movement specifications for move_through_joint_positions.
Definition arm.hpp:66
Optional features that the specific arm supports.
Definition arm.hpp:74
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
Options for a GetKinematics request.
Definition kinematics.hpp:39
Definition pose.hpp:30