|
Viam C++ SDK current
|
gRPC client implementation of an Arm component.
More...
#include <arm_client.hpp>
Inheritance diagram for viam::sdk::impl::ArmClient:Public Types | |
| using | interface_type = Arm |
Public Types inherited from viam::sdk::Arm | |
| enum class | stream_outcome : std::uint8_t { k_completed = 0 , k_halted_by_update_handler } |
| How a streamed trajectory execution ended. More... | |
| using | MoveLimit = boost::variant<double, std::vector<double>> |
| A movement limit: either a single scalar applied uniformly, or per-joint values. | |
Public Member Functions | |
| ArmClient (std::string name, const ViamChannel &channel) | |
| const ViamChannel & | channel () const |
| pose | get_end_position (const ProtoStruct &extra) override |
| Get the current position of the end of the arm. | |
| void | move_to_position (const pose &pose, const ProtoStruct &extra) override |
| Move the end of the arm to. | |
| 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 | 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. | |
| Arm::stream_outcome | move_through_joint_positions_streamed (const std::function< boost::optional< std::vector< Arm::trajectory_point > >()> &batch_source, const std::function< bool(Arm::trajectory_update)> &update_handler, const ProtoStruct &extra) override |
| bool | is_moving () override |
| Reports if the arm is in motion. | |
| ProtoStruct | get_status () override |
| Get the status of the arm. | |
| void | stop (const ProtoStruct &extra) override |
| Stops a resource from running. | |
| ProtoStruct | do_command (const ProtoStruct &command) override |
| Send/receive arbitrary commands to the resource. | |
| ::viam::sdk::KinematicsData | get_kinematics (const ProtoStruct &extra) override |
| Get the kinematics data associated with the arm. | |
| std::map< std::string, mesh > | get_3d_models (const ProtoStruct &extra) override |
Returns 3DModels associated with the calling arm. | |
| std::vector< GeometryConfig > | get_geometries (const ProtoStruct &extra) override |
Returns GeometryConfigs associated with the calling arm. | |
| virtual std::map< std::string, mesh > | get_3d_models (const ProtoStruct &extra)=0 |
Returns 3DModels associated with the calling arm. | |
| std::map< std::string, mesh > | get_3d_models () |
Returns 3DModels associated with the calling arm. | |
| pose | get_end_position () |
| Get the current position of the end of the arm. | |
| virtual pose | get_end_position (const ProtoStruct &extra)=0 |
| Get the current position of the end of the arm. | |
| std::vector< GeometryConfig > | get_geometries () |
Returns GeometryConfigs associated with the calling arm. | |
| virtual std::vector< GeometryConfig > | get_geometries (const ProtoStruct &extra)=0 |
Returns GeometryConfigs associated with the calling arm. | |
| std::vector< double > | get_joint_positions () |
| Lists the joint positions in degrees of every joint on a robot arm. | |
| virtual std::vector< double > | get_joint_positions (const ProtoStruct &extra)=0 |
| Lists the joint positions in degrees of every joint on a robot arm. | |
| virtual::viam::sdk::KinematicsData | get_kinematics (const ProtoStruct &extra)=0 |
| Get the kinematics data associated with the arm. | |
| inline ::viam::sdk::KinematicsData | get_kinematics () |
| Get the kinematics data associated with the arm. | |
| 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. | |
| 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. | |
| stream_outcome | move_through_joint_positions_streamed (const std::function< boost::optional< std::vector< trajectory_point > >()> &batch_source, const std::function< bool(trajectory_update)> &update_handler) |
| Execute a stream of trajectory points in order. | |
| virtual stream_outcome | move_through_joint_positions_streamed (const std::function< boost::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. | |
| void | move_to_joint_positions (const std::vector< double > &positions) |
| Move each joint on the arm to the corresponding angle specified in. | |
| 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_to_position (const pose &pose) |
| Move the end of the arm to. | |
| virtual void | move_to_position (const pose &pose, const ProtoStruct &extra)=0 |
| Move the end of the arm to. | |
Public Member Functions inherited from viam::sdk::Arm | |
| pose | get_end_position () |
| Get the current position of the end of the arm. | |
| void | move_to_position (const pose &pose) |
| Move the end of the arm to. | |
| std::vector< double > | get_joint_positions () |
| Lists the joint positions in degrees of every joint on a robot arm. | |
| void | move_to_joint_positions (const std::vector< double > &positions) |
| 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. | |
| stream_outcome | move_through_joint_positions_streamed (const std::function< boost::optional< std::vector< trajectory_point > >()> &batch_source, const std::function< bool(trajectory_update)> &update_handler) |
| Execute a stream of trajectory points in order. | |
| inline ::viam::sdk::KinematicsData | get_kinematics () |
| Get the kinematics data associated with the arm. | |
| std::map< std::string, mesh > | get_3d_models () |
Returns 3DModels associated with the calling arm. | |
| std::vector< GeometryConfig > | get_geometries () |
Returns GeometryConfigs associated with the calling arm. | |
| API | api () const override |
Returns the API associated with a particular resource. | |
Public Member Functions inherited from viam::sdk::Component | |
| Name | get_resource_name () const override |
Returns the Name for a particular resource. | |
Public Member Functions inherited from viam::sdk::Resource | |
| Resource (std::string name) | |
| virtual std::string | name () const |
| Return the resource's name. | |
| void | set_log_level (log_level) const |
| Set the log level for log messages originating from this Resource. | |
Public Member Functions inherited from viam::sdk::Stoppable | |
| void | stop () |
| Stops a resource from running. | |
Additional Inherited Members | |
Protected Member Functions inherited from viam::sdk::Arm | |
| Arm (std::string name) | |
Protected Member Functions inherited from viam::sdk::Component | |
| Component (std::string name) | |
Protected Member Functions inherited from viam::sdk::Resource | |
| Name | get_resource_name (const std::string &type) const |
Protected Attributes inherited from viam::sdk::Resource | |
| LogSource | logger_ |
gRPC client implementation of an Arm component.
|
overridevirtual |
Send/receive arbitrary commands to the resource.
| Command | the command to execute. |
Implements viam::sdk::Arm.
|
inline |
Returns 3DModels associated with the calling arm.
3DModels associated with the calling arm
|
overridevirtual |
Returns 3DModels associated with the calling arm.
| extra | Any additional arguments to the method |
3DModels associated with the calling arm Implements viam::sdk::Arm.
|
virtual |
Returns 3DModels associated with the calling arm.
| extra | Any additional arguments to the method |
3DModels associated with the calling arm Implements viam::sdk::Arm.
|
inline |
Get the current position of the end of the arm.
pose representing the end position of the arm.
|
overridevirtual |
Get the current position of the end of the arm.
| extra | Any additional arguments to the method. |
pose representing the end position of the arm. Implements viam::sdk::Arm.
|
virtual |
Get the current position of the end of the arm.
| extra | Any additional arguments to the method. |
pose representing the end position of the arm. Implements viam::sdk::Arm.
|
overridevirtual |
Returns GeometryConfigs associated with the calling arm.
| extra | Any additional arguments to the method |
Implements viam::sdk::Arm.
|
virtual |
Returns GeometryConfigs associated with the calling arm.
| extra | Any additional arguments to the method |
Implements viam::sdk::Arm.
|
overridevirtual |
Lists the joint positions in degrees of every joint on a robot arm.
| extra | Any additional arguments to the method. |
Implements viam::sdk::Arm.
|
virtual |
Lists the joint positions in degrees of every joint on a robot arm.
| extra | Any additional arguments to the method. |
Implements viam::sdk::Arm.
|
inline |
Get the kinematics data associated with the arm.
|
overridevirtual |
Get the kinematics data associated with the arm.
| extra | Any additional arguments to the method. |
Implements viam::sdk::Arm.
|
virtual |
Get the kinematics data associated with the arm.
| extra | Any additional arguments to the method. |
Implements viam::sdk::Arm.
|
overridevirtual |
Get the status of the arm.
ProtoStruct containing the status of the arm. Implements viam::sdk::Arm.
|
overridevirtual |
Reports if the arm is in motion.
Implements viam::sdk::Arm.
|
overridevirtual |
Move each joint on the arm through the positions specified in.
| positions | |
| options | optional specifications to be obeyed during the motion. |
| extra | Any additional arguments to the method. |
Implements viam::sdk::Arm.
|
inline |
Move each joint on the arm through the positions specified in.
| positions | |
| options | optional specifications to be obeyed during the motion. TODO consider replacing vector vector with xtensor array, and also if it may be possible to specify or constrain dimensionality of the array in advance. |
|
virtual |
Move each joint on the arm through the positions specified in.
| positions | |
| options | optional specifications to be obeyed during the motion. |
| extra | Any additional arguments to the method. |
Implements viam::sdk::Arm.
|
inline |
Execute a stream of trajectory points in order.
| batch_source | Pull-source for the next batch of waypoints. |
| update_handler | Handler invoked for each update the implementation emits. |
|
virtual |
Execute a stream of trajectory points in order.
This is the streamed analogue of move_through_joint_positions. It is implemented on both sides of the RPC: an arm driver implements it to execute a trajectory, and the SDK arm client implements it to forward the call to a remote arm. Both sides must follow the contract below.
An implementation pulls the trajectory from batch_source and reports progress through update_handler until the stream is exhausted, it is asked to stop, or it faults. A fault is reported by throwing: a server-side implementation has its exception converted to a terminal gRPC status delivered to the remote caller, and a client-side implementation rethrows to its caller. An exception thrown out of update_handler is propagated the same way rather than swallowed, so neither callback is required to be noexcept.
Threading: because the stream is bidirectional, an implementation is permitted to invoke the two callbacks from different threads and to run them concurrently with each other. A caller must therefore not assume the callbacks are serialized against one another or pinned to a single thread, and must synchronize any mutable state it shares between them. A given callback is never invoked concurrently with itself.
| batch_source | Pull-source for the trajectory. Call it to obtain the next batch of waypoints; it yields boost::none once no more points are coming, after which the implementation should finish executing what it already has and return. Points arrive grouped into the batches the sender chose; an implementation that wants per-point handling iterates within each batch. Note that for servers, a disengaged return is ambiguous between end-of-stream and cancellation. Arm implementors are expected to explicitly check for cancellation. |
| update_handler | Sink for execution updates. Call it with each trajectory_update to report progress; it returns true to keep going and false to ask that the stream stop early, in which case the implementation should stop executing and return stream_outcome::k_halted_by_update_handler. |
| extra | Any additional arguments to the method. |
stream_outcome::k_completed if the trajectory ran to its natural end, or stream_outcome::k_halted_by_update_handler if update_handler asked it to stop. Implements viam::sdk::Arm.
|
inline |
Move each joint on the arm to the corresponding angle specified in.
| positions |
|
overridevirtual |
Move each joint on the arm to the corresponding angle specified in.
| positions | |
| extra | Any additional arguments to the method. |
Implements viam::sdk::Arm.
|
virtual |
Move each joint on the arm to the corresponding angle specified in.
| positions | |
| extra | Any additional arguments to the method. |
Implements viam::sdk::Arm.
|
inline |
Move the end of the arm to.
| pose. |
|
overridevirtual |
Move the end of the arm to.
| pose. | |
| pose | The destination pose for the arm. |
| extra | Any additional arguments to the method. |
Implements viam::sdk::Arm.
|
virtual |
Move the end of the arm to.
| pose. | |
| pose | The destination pose for the arm. |
| extra | Any additional arguments to the method. |
Implements viam::sdk::Arm.
|
overridevirtual |
Stops a resource from running.
| extra | Extra arguments to pass to the resource's stop method. |
Implements viam::sdk::Stoppable.