Viam C++ SDK current
Loading...
Searching...
No Matches
kinematics_model_table.hpp
Go to the documentation of this file.
1
4#pragma once
5
6#include <string>
7#include <vector>
8
9#if defined(__has_include) && (__has_include(<xtensor/containers/xarray.hpp>))
10#include <xtensor/containers/xarray.hpp>
11#else
12#include <xtensor/xarray.hpp>
13#endif
14
15#include <viam/sdk/common/kinematics.hpp>
16#include <viam/sdk/common/linear_algebra.hpp>
17
18namespace viam {
19namespace sdk {
20
25 public:
29 enum class JointType {
30 k_revolute = 0,
31 k_continuous = 1,
32 k_prismatic = 2,
33 k_fixed = 3,
34 };
35
38 struct JointRow {
39 std::string name;
40 Vector3 xyz{};
41 Vector3 rpy{};
42 Vector3 axis{};
43 JointType type = JointType::k_fixed;
44 };
45
47 explicit ModelTable(std::vector<JointRow> rows);
48
52 static ModelTable from(const KinematicsDataURDF& urdf);
53
60 static ModelTable from(const xt::xarray<double>& tensor);
61
66 xt::xarray<double> to_tensor() const;
67
69 const std::vector<JointRow>& rows() const;
70
71 private:
72 std::vector<JointRow> rows_;
73};
74
75} // namespace sdk
76} // namespace viam
A per-joint model table for a serial kinematic chain, held in chain order. Build one with the from fa...
Definition kinematics_model_table.hpp:24
static ModelTable from(const KinematicsDataURDF &urdf)
Parse a kinematics description into a model table in chain order.
const std::vector< JointRow > & rows() const
The rows of the table, 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,...
ModelTable(std::vector< JointRow > rows)
Construct directly from rows already 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 ...
JointType
URDF joint type, restricted to arm-relevant joints.
Definition kinematics_model_table.hpp:29
Kinematics data in URDF format with optional meshes by URDF filepath.
Definition kinematics.hpp:53
One row of the model table: the per-joint URDF fields.
Definition kinematics_model_table.hpp:38
Definition linear_algebra.hpp:25