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
mc_rbdyn::RobotConverter
Copies all common properties from one robot to another encoders, sensors, etc)
Definition: RobotConverter.h:22
mc_rbdyn::RobotConverterConfig
Configuration for mc_rbdyn::RobotConverter.
Definition: RobotConverterConfig.h:15
mc_rbdyn::RobotConverter::config
const RobotConverterConfig & config() const noexcept
Definition: RobotConverter.h:43
mc_rbdyn::Robot
Definition: Robot.h:62
RobotConverterConfig.h
Robot.h
MC_RBDYN_DLLAPI
#define MC_RBDYN_DLLAPI
Definition: api.h:50
mc_rbdyn
Definition: generic_gripper.h:14
mc_rbdyn::RobotConverter::config_
RobotConverterConfig config_
Definition: RobotConverter.h:60