gRPC client for a robot, to be used for all interactions with a robot. There are two ways to instantiate a robot:
More...
#include "robot/client.hpp"
|
void | refresh () |
|
void | close () |
|
| RobotClient (std::shared_ptr< ViamChannel > channel) |
|
std::vector< Name > | resource_names () const |
|
std::shared_ptr< Resource > | resource_by_name (const Name &name) |
| Lookup and return a shared_ptr to a resource.
|
|
template<typename T > |
std::shared_ptr< T > | resource_by_name (std::string name) |
| Lookup and return a shared_ptr to a resource of the requested type.
|
|
std::vector< frame_system_config > | get_frame_system_config (const std::vector< WorldState::transform > &additional_transforms={}) |
| Get the configuration of the frame system of the given robot.
|
|
std::vector< operation > | get_operations () |
| Get the list of operations currently running on a robot.
|
|
pose_in_frame | transform_pose (const pose_in_frame &query, std::string destination, const std::vector< WorldState::transform > &additional_transforms={}) |
| Transform a given Pose to a new specified destination which is a reference frame.
|
|
void | block_for_operation (std::string id) |
| Blocks on the specified operation of the robot, returning when it is complete.
|
|
void | stop_all () |
| Cancel all operations for the robot and stop all actuators and movement.
|
|
void | stop_all (const std::unordered_map< Name, ProtoStruct > &extra) |
| Cancel all operations for the robot and stop all actuators and movement.
|
|
void | cancel_operation (std::string id) |
| Cancel a specified operation on the robot.
|
|
|
static std::shared_ptr< RobotClient > | at_address (const std::string &address, const Options &options) |
| Create a robot client connected to the robot at the provided address.
|
|
static std::shared_ptr< RobotClient > | at_local_socket (const std::string &address, const Options &options) |
| Creates a robot client connected to the robot at the provided local socket.
|
|
static std::shared_ptr< RobotClient > | with_channel (std::shared_ptr< ViamChannel > channel, const Options &options) |
| Creates a robot client connected to the provided channel.
|
|
gRPC client for a robot, to be used for all interactions with a robot. There are two ways to instantiate a robot:
RobotClient::at_address(...)
RobotClient::with_channel(...)
You must close()
a robot when finished with it in order to release its resources. Robots creates via at_address
will automatically close, but robots created via with_channel
require a user call to close()
.
◆ at_address()
static std::shared_ptr< RobotClient > viam::sdk::RobotClient::at_address |
( |
const std::string & | address, |
|
|
const Options & | options ) |
|
static |
Create a robot client connected to the robot at the provided address.
- Parameters
-
address | The address of the robot (IP address, URI, URL, etc.) |
options | Options for connecting and refreshing. |
◆ at_local_socket()
static std::shared_ptr< RobotClient > viam::sdk::RobotClient::at_local_socket |
( |
const std::string & | address, |
|
|
const Options & | options ) |
|
static |
Creates a robot client connected to the robot at the provided local socket.
- Parameters
-
address | The local socket of the robot (a .sock file, etc.). |
options | Options for connecting and refreshing. Creates a direct connection to the robot using the unix:// scheme. Only useful for connecting to robots across Unix sockets. |
◆ block_for_operation()
void viam::sdk::RobotClient::block_for_operation |
( |
std::string | id | ) |
|
Blocks on the specified operation of the robot, returning when it is complete.
- Parameters
-
id | The ID of the operation to block on. |
◆ cancel_operation()
void viam::sdk::RobotClient::cancel_operation |
( |
std::string | id | ) |
|
Cancel a specified operation on the robot.
- Parameters
-
id | The ID of the operation to cancel. |
◆ get_frame_system_config()
Get the configuration of the frame system of the given robot.
- Returns
- The configuration of the calling robot's frame system.
◆ get_operations()
std::vector< operation > viam::sdk::RobotClient::get_operations |
( |
| ) |
|
Get the list of operations currently running on a robot.
- Returns
- The list of operations currently running on the calling robot.
◆ resource_by_name() [1/2]
std::shared_ptr< Resource > viam::sdk::RobotClient::resource_by_name |
( |
const Name & | name | ) |
|
Lookup and return a shared_ptr
to a resource.
- Parameters
-
name | The Name of the resource. |
- Exceptions
-
`Exception` | if the requested resource doesn't exist or is the wrong type. |
- Returns
- a
shared_ptr
to the requested resource as an uncasted Resource
.
This method should not be called directly except in specific cases. The type-annotated resource_by_name<T>(name)
overload is the preferred method for obtaining resources.
Because the return type here is a Resource
, the user will need to manually cast to the desired type.
◆ resource_by_name() [2/2]
template<typename T >
std::shared_ptr< T > viam::sdk::RobotClient::resource_by_name |
( |
std::string | name | ) |
|
|
inline |
Lookup and return a shared_ptr
to a resource of the requested type.
- Parameters
-
name | The ordinary name of the resource. |
- Exceptions
-
`Exception` | if the requested resource doesn't exist or is the wrong type. |
- Returns
- a
shared_ptr
to the requested resource.
◆ stop_all()
void viam::sdk::RobotClient::stop_all |
( |
const std::unordered_map< Name, ProtoStruct > & | extra | ) |
|
Cancel all operations for the robot and stop all actuators and movement.
- Parameters
-
extra | Any extra params to pass to resources' stop methods, keyed by Name . |
◆ transform_pose()
Transform a given Pose
to a new specified destination which is a reference frame.
- Parameters
-
query | The pose that should be transformed. |
destination | The name of the reference frame to transform the given pose to. |
- Returns
- the
pose_in_frame
of the transformed pose.
◆ with_channel()
Creates a robot client connected to the provided channel.
- Parameters
-
channel | The channel to connect with. |
options | Options for connecting and refreshing. Connects directly to a pre-existing channel. A robot created this way must be close() d manually. |
The documentation for this class was generated from the following file: