RobotConverter.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 CNRS-UM LIRMM, CNRS-AIST JRL
3  */
4 
5 #pragma once
6 
7 #include <mc_rbdyn/Robot.h>
9 
10 namespace mc_rbdyn
11 {
12 
23 {
32  RobotConverter(const mc_rbdyn::Robot & inputRobot,
33  mc_rbdyn::Robot & outputRobot,
34  const RobotConverterConfig & config);
35 
41  void convert(const mc_rbdyn::Robot & inputRobot, mc_rbdyn::Robot & outputRobot) const;
42 
43  inline const RobotConverterConfig & config() const noexcept { return config_; }
44 
45 protected:
50  void precompute(const mc_rbdyn::Robot & inputRobot, const mc_rbdyn::Robot & outputRobot);
51 
57  void encodersToOutput(const mc_rbdyn::Robot & inputRobot, mc_rbdyn::Robot & outputRobot) const;
58 
59 protected:
61  // Common joint indices from inputRobot_ -> outputRobot_ robot
62  std::vector<std::pair<unsigned int, unsigned int>> commonJointIndices_{};
63  // Encoder indices from inputRobot_ -> outputRobot_ robot
64  std::vector<std::pair<unsigned int, unsigned int>> commonEncoderToJointIndices_{};
65  // Indices of joints with mimics from actuated joints in inputRobot_
66  // to their mimic counterpart in outputRobot_
67  std::vector<std::pair<unsigned int, unsigned int>> mimicJoints_{};
68 };
69 } // namespace mc_rbdyn
#define MC_RBDYN_DLLAPI
Definition: api.h:50
Definition: generic_gripper.h:15
Configuration for mc_rbdyn::RobotConverter.
Definition: RobotConverterConfig.h:16
Copies all common properties from one robot to another encoders, sensors, etc)
Definition: RobotConverter.h:23
void precompute(const mc_rbdyn::Robot &inputRobot, const mc_rbdyn::Robot &outputRobot)
Precomputes the mappings of common properties between input/output robot according to the chosen conf...
void encodersToOutput(const mc_rbdyn::Robot &inputRobot, mc_rbdyn::Robot &outputRobot) const
RobotConverter(const mc_rbdyn::Robot &inputRobot, mc_rbdyn::Robot &outputRobot, const RobotConverterConfig &config)
RobotConverterConfig config_
Definition: RobotConverter.h:60
const RobotConverterConfig & config() const noexcept
Definition: RobotConverter.h:43
void convert(const mc_rbdyn::Robot &inputRobot, mc_rbdyn::Robot &outputRobot) const
Copies the common properties of the input robot to the output robot.
Definition: Robot.h:63