20 static constexpr int kDOF = 14;
21 static constexpr int kDeivceCount = kDOF + 2;
22 static constexpr double kTorqueScaling = 0.5;
23 static constexpr double kMaximumTorque = 4.;
25 static constexpr int kRightToolId = 0x80;
26 static constexpr int kLeftToolId = 0x81;
29 Eigen::Vector<double, kDOF> q_joint;
30 Eigen::Vector<double, kDOF> qvel_joint;
31 Eigen::Vector<double, kDOF> torque_joint;
32 Eigen::Vector<double, kDOF> gravity_term;
34 Eigen::Vector<int, kDOF> operating_mode;
35 Eigen::Vector<double, kDOF> target_position;
40 math::SE3::MatrixType T_right;
41 math::SE3::MatrixType T_left;
45 Eigen::Vector<int, kDOF> target_operating_mode;
46 Eigen::Vector<double, kDOF> target_position;
47 Eigen::Vector<double, kDOF> target_torque;
50 explicit MasterArm(
const std::string& dev_name = kMasterArmDeviceName);
54 void SetControlPeriod(
double control_period);
56 void SetModelPath(
const std::string& model_path);
58 void SetTorqueConstant(
const std::array<double, kDOF>& torque_constant);
60 std::vector<int> Initialize(
bool verbose =
false);
62 bool StartControl(
const std::function<
ControlInput(
const State& state)>& control =
nullptr);
64 bool StopControl(
bool torque_disable =
false);
71 bool initialized_{
false};
74 double control_period_;
75 std::array<double, kDOF> torque_constant_;
78 std::atomic<bool> ctrl_running_{
false};
80 std::shared_ptr<DynamixelBus> handler_;
81 std::shared_ptr<dyn::Robot<kDOF>> dyn_robot_;
82 std::shared_ptr<dyn::State<kDOF>> dyn_state_;
84 std::string model_path_;
86 std::atomic<bool> is_running_{
false};
87 std::vector<int> active_ids_;
90 bool operating_mode_init_{
false};
92 std::function<ControlInput(
const State& state)> control_;