Control Libraries 6.3.4
Loading...
Searching...
No Matches
encoders.h
1#pragma once
2
3#include <google/protobuf/repeated_field.h>
4
5#include <state_representation/State.hpp>
6#include <state_representation/space/SpatialState.hpp>
7#include <state_representation/space/cartesian/CartesianState.hpp>
8#include <state_representation/space/Jacobian.hpp>
9#include <state_representation/space/joint/JointState.hpp>
10#include <state_representation/parameters/Parameter.hpp>
11
12#include "clproto.h"
13#include "state_representation/state_message.pb.h"
14
15namespace clproto {
16
23template<typename ParamT>
24state_representation::proto::Parameter encoder(const state_representation::Parameter<ParamT>& parameter);
25
33template<typename FieldT>
34google::protobuf::RepeatedField<FieldT> encoder(const std::vector<FieldT>& data);
35
42google::protobuf::RepeatedField<double> matrix_encoder(const Eigen::MatrixXd& matrix);
43
44/*
45 * Declarations for encoding helpers
46 */
47state_representation::proto::StateType encoder(const state_representation::StateType& type);
48state_representation::proto::State encoder(const state_representation::State& state);
49state_representation::proto::SpatialState encoder(const state_representation::SpatialState& spatial_state);
50state_representation::proto::Vector3d encoder(const Eigen::Vector3d& vector);
51state_representation::proto::Quaterniond encoder(const Eigen::Quaterniond& quaternion);
52state_representation::proto::CartesianState encoder(const state_representation::CartesianState& cartesian_state);
53state_representation::proto::Jacobian encoder(const state_representation::Jacobian& jacobian);
54state_representation::proto::JointState encoder(const state_representation::JointState& joint_state);
55
56/*
57 * Definitions for templated RepeatedField methods
58 */
59template<typename FieldT>
60google::protobuf::RepeatedField<FieldT> encoder(const std::vector<FieldT>& data) {
61 return google::protobuf::RepeatedField<FieldT>({data.begin(), data.end()});
62}
63}
Class to represent a state in Cartesian space.
Class to define a robot Jacobian matrix.
Definition: Jacobian.hpp:20
Class to define a state in joint space.
Definition: JointState.hpp:36
Abstract class to represent a state.
Definition: State.hpp:25
Bindings to encode and decode state objects into serialised binary message.
state_representation::proto::Parameter encoder(const state_representation::Parameter< ParamT > &parameter)
Encoding helper method for the Parameter type.
google::protobuf::RepeatedField< double > matrix_encoder(const Eigen::MatrixXd &matrix)
Encoding helper method for Eigen data into a RepeatedField message type.
Definition: encoders.cpp:7
StateType
The class types inheriting from State.
Definition: StateType.hpp:13