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"
|
enum class | status : uint8_t { k_initializing
, k_running
, k_unspecified
} |
| the current status of the robot
|
|
|
| RobotClient (ViamChannel channel) |
|
void | refresh () |
| Call out to the robot to see if there are any new resources that need to be registered. Compares the currently registered resources to the ones from the robot, seeing if any updates have been made. If so, they are registered and updated in ResourceManager. This method can be called manually, or it will be called periodically and automatically if a positive refresh_interval is passed in the Options of the named constructors.
|
|
void | close () |
| Disconnect this robot client from any robot to which it is connected. After calling this method it is no longer valid to call any methods which communicate with the robot.
|
|
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.
|
|
status | get_machine_status () const |
| gets the current status of the machine
|
|
|
class | ModuleService |
|
struct | impl::LogBackend |
|
std::ostream & | operator<< (std::ostream &os, const status &v) |
|
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(...)
◆ 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. |
The documentation for this class was generated from the following file: