Viam C++ SDK current
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
viam::sdk::ModelTable Class Reference

A per-joint model table for a serial kinematic chain, held in chain order. Build one with the from factories and read it back via rows() or to_tensor(). More...

#include <kinematics_model_table.hpp>

Classes

struct  JointRow
 One row of the model table: the per-joint URDF fields. More...
 

Public Types

enum class  JointType { k_revolute = 0 , k_continuous = 1 , k_prismatic = 2 , k_fixed = 3 }
 URDF joint type, restricted to arm-relevant joints. More...
 

Public Member Functions

 ModelTable (std::vector< JointRow > rows)
 Construct directly from rows already in chain order.
 
xt::xarray< double > to_tensor () const
 Convert to a double tensor of shape (n, 10). Columns: 0..2 xyz, 3..5 rpy, 6..8 axis, 9 joint type as the underlying value of JointType (see enum declaration for the encoding).
 
const std::vector< JointRow > & rows () const
 The rows of the table, in chain order.
 

Static Public Member Functions

static ModelTable from (const KinematicsDataURDF &urdf)
 Parse a kinematics description into a model table in chain order.
 
static ModelTable from (const xt::xarray< double > &tensor)
 Inverse of to_tensor: rehydrate an (n, 10) double tensor into a model table. Reconstructed rows have empty name (names are not carried in the tensor).
 

Detailed Description

A per-joint model table for a serial kinematic chain, held in chain order. Build one with the from factories and read it back via rows() or to_tensor().

Member Enumeration Documentation

◆ JointType

URDF joint type, restricted to arm-relevant joints.

Note
Underlying values are stable and form the wire encoding for column 9 of the tensor produced by to_tensor().

Member Function Documentation

◆ from() [1/2]

static ModelTable viam::sdk::ModelTable::from ( const KinematicsDataURDF & urdf)
static

Parse a kinematics description into a model table in chain order.

Exceptions
viam::sdk::Exceptionon parse error, branching / multi-root / disconnected topology, unsupported joint types, or zero axis.

◆ from() [2/2]

static ModelTable viam::sdk::ModelTable::from ( const xt::xarray< double > & tensor)
static

Inverse of to_tensor: rehydrate an (n, 10) double tensor into a model table. Reconstructed rows have empty name (names are not carried in the tensor).

Exceptions
viam::sdk::Exceptionon non-2D input, wrong column count, empty input, or invalid joint-type encoding (col 9 must be an integer matching one of the JointType values).

◆ to_tensor()

xt::xarray< double > viam::sdk::ModelTable::to_tensor ( ) const

Convert to a double tensor of shape (n, 10). Columns: 0..2 xyz, 3..5 rpy, 6..8 axis, 9 joint type as the underlying value of JointType (see enum declaration for the encoding).

Exceptions
viam::sdk::Exceptionon empty table.

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