Viam C++ SDK current
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
viam::sdk::FrameSystem Class Referenceabstract

The machine's frame system: the tree of reference frames viam-server builds from the frame config of every resource. Use it to find where a component is and to move poses and point clouds between frames. More...

#include "services/framesystem.hpp"

+ Inheritance diagram for viam::sdk::FrameSystem:

Classes

struct  frame_system_config
 One frame of the frame system, with the kinematics of the resource it belongs to. More...
 

Public Member Functions

std::vector< frame_system_config > get_frame_system_config ()
 Get the configuration of every frame in the frame system.
 
virtual std::vector< frame_system_config > get_frame_system_config (const std::vector< WorldState::transform > &additional_transforms)=0
 Get the configuration of every frame in the frame system.
 
pose_in_frame get_pose (const std::string &component_name)
 Get the pose of a component in the world reference frame.
 
pose_in_frame get_pose (const std::string &component_name, const std::string &destination_frame, const std::vector< WorldState::transform > &supplemental_transforms)
 Get the pose of a component in the desired reference frame.
 
virtual pose_in_frame get_pose (const std::string &component_name, const std::string &destination_frame, const std::vector< WorldState::transform > &supplemental_transforms, const ProtoStruct &extra)=0
 Get the pose of a component in the desired reference frame.
 
pose_in_frame transform_pose (const pose_in_frame &query, const std::string &destination)
 Express a pose in a different reference frame.
 
virtual pose_in_frame transform_pose (const pose_in_frame &query, const std::string &destination, const std::vector< WorldState::transform > &additional_transforms)=0
 Express a pose in a different reference frame.
 
virtual std::vector< unsigned char > transform_pcd (const std::vector< unsigned char > &pcd, const std::string &source, const std::string &destination)=0
 Express a point cloud in a different reference frame.
 
API api () const override
 Returns the API associated with a particular resource.
 
- Public Member Functions inherited from viam::sdk::Service
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)
 
 Resource (const ResourceConfig &cfg)
 Construct from a resource config. Use this overload to ensure Viam App log filtering works immediately during object construction.
 
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.
 

Static Public Member Functions

static Name public_name ()
 The full resource name of the machine's frame system. Its short name is kPublicName.
 

Static Public Attributes

static const std::string kPublicName
 The reserved name viam-server publishes the machine's frame system under.
 

Protected Member Functions

 FrameSystem (std::string name)
 
 FrameSystem (const ResourceConfig &cfg)
 
- Protected Member Functions inherited from viam::sdk::Service
 Service (std::string name)
 
 Service (const ResourceConfig &cfg)
 
- Protected Member Functions inherited from viam::sdk::Resource
Name get_resource_name (const std::string &type) const
 

Additional Inherited Members

- Protected Attributes inherited from viam::sdk::Resource
LogSource logger_
 

Detailed Description

The machine's frame system: the tree of reference frames viam-server builds from the frame config of every resource. Use it to find where a component is and to move poses and point clouds between frames.

viam-server owns one frame system per machine and publishes it under the reserved name $framesystem. A modular resource finds it in its Dependencies under that name, and RobotClient::resource_by_name hands it out under that name too. It is never listed in RobotClient::resource_names.

Member Function Documentation

◆ api()

API viam::sdk::FrameSystem::api ( ) const
overridevirtual

Returns the API associated with a particular resource.

Implements viam::sdk::Resource.

◆ get_frame_system_config()

virtual std::vector< frame_system_config > viam::sdk::FrameSystem::get_frame_system_config ( const std::vector< WorldState::transform > & additional_transforms)
pure virtual

Get the configuration of every frame in the frame system.

Parameters
additional_transformsExtra frames to add to the frame system for this call only.

Implemented in viam::sdk::impl::FrameSystemClient.

◆ get_pose() [1/3]

pose_in_frame viam::sdk::FrameSystem::get_pose ( const std::string & component_name)
inline

Get the pose of a component in the world reference frame.

Parameters
component_nameThe component whose pose is being requested.

◆ get_pose() [2/3]

pose_in_frame viam::sdk::FrameSystem::get_pose ( const std::string & component_name,
const std::string & destination_frame,
const std::vector< WorldState::transform > & supplemental_transforms )
inline

Get the pose of a component in the desired reference frame.

Parameters
component_nameThe component whose pose is being requested.
destination_frameThe reference frame in which to express the pose.
supplemental_transformsExtra frames needed to compute the pose.

◆ get_pose() [3/3]

virtual pose_in_frame viam::sdk::FrameSystem::get_pose ( const std::string & component_name,
const std::string & destination_frame,
const std::vector< WorldState::transform > & supplemental_transforms,
const ProtoStruct & extra )
pure virtual

Get the pose of a component in the desired reference frame.

Parameters
component_nameThe component whose pose is being requested.
destination_frameThe reference frame in which to express the pose.
supplemental_transformsExtra frames needed to compute the pose.
extraAny additional arguments to the method.

Implemented in viam::sdk::impl::FrameSystemClient.

◆ transform_pcd()

virtual std::vector< unsigned char > viam::sdk::FrameSystem::transform_pcd ( const std::vector< unsigned char > & pcd,
const std::string & source,
const std::string & destination )
pure virtual

Express a point cloud in a different reference frame.

Parameters
pcdThe point cloud, serialized in PCD format.
sourceThe reference frame the point cloud is currently expressed in.
destinationThe reference frame to express the point cloud in.
Returns
The transformed point cloud, serialized in PCD format as raw PCD bytes.

Implemented in viam::sdk::impl::FrameSystemClient.

◆ transform_pose() [1/2]

pose_in_frame viam::sdk::FrameSystem::transform_pose ( const pose_in_frame & query,
const std::string & destination )
inline

Express a pose in a different reference frame.

Parameters
queryThe pose to transform, with the frame it is currently expressed in.
destinationThe reference frame to express the pose in.

◆ transform_pose() [2/2]

virtual pose_in_frame viam::sdk::FrameSystem::transform_pose ( const pose_in_frame & query,
const std::string & destination,
const std::vector< WorldState::transform > & additional_transforms )
pure virtual

Express a pose in a different reference frame.

Parameters
queryThe pose to transform, with the frame it is currently expressed in.
destinationThe reference frame to express the pose in.
additional_transformsExtra frames needed to compute the transform.

Implemented in viam::sdk::impl::FrameSystemClient.


The documentation for this class was generated from the following file: