ethercatcpp
shadow_hand.h
Go to the documentation of this file.
1 /* File: shadow_hand.h
2  * This file is part of the program ethercatcpp-shadow
3  * Program description : EtherCAT driver library for shadow hand.
4  * Copyright (C) 2018-2022 - Robin Passama (CNRS/LIRMM) Arnaud Meline
5  * (CNRS/LIRMM) Benjamin Navarro (CNRS/LIRMM). All Right reserved.
6  *
7  * This software is free software: you can redistribute it and/or modify
8  * it under the terms of the CeCILL-C license as published by
9  * the CEA CNRS INRIA, either version 1
10  * of the License, or (at your option) any later version.
11  * This software is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * CeCILL-C License for more details.
15  *
16  * You should have received a copy of the CeCILL-C License
17  * along with this software. If not, it can be found on the official
18  * website of the CeCILL licenses family (http://www.cecill.info/index.en.html).
19  */
28 #pragma once
29 
31 #include <ethercatcpp/core.h>
32 
33 #include <math-utils/interpolator.h>
34 
35 #include <memory>
36 
41 namespace ethercatcpp {
42 
51 class ShadowHand : public BusDevice {
52 public:
64  ShadowHand(shadow::HandID hand_id, shadow::BiotacMode biotac_electrode_mode,
65  shadow::ControlMode control_mode,
66  std::unique_ptr<
67  math::Interpolator<std::array<uint16_t, shadow::joint_count>,
68  std::array<double, shadow::joint_count>>>
69  joint_position_interpolator);
70 
80  ShadowHand(shadow::HandID hand_id, shadow::BiotacMode biotac_electrode_mode,
81  shadow::ControlMode control_mode);
82 
83  ~ShadowHand();
84 
90  const shadow::RawHandState& state() const;
91 
97  const shadow::RawHandCommand& command() const;
98 
105 
110  void read_joints_torques();
111 
117 
122  void read_joints_positions();
123 
128  void read_biotacs_pressures();
129 
135 
141 
146  void read();
147 
152  void write_joints_commands();
153 
159  void write();
160 
161  // Printing all datas
169  void print_fingers_torques();
175  void print_biotacs_data();
176 
177  static std::unique_ptr<
178  math::Interpolator<std::array<uint16_t, shadow::joint_count>,
179  std::array<double, shadow::joint_count>>>
181 
182 private:
183  class pImpl;
184  std::unique_ptr<pImpl> impl_;
185 
188 
189  pImpl& impl() {
190  return *impl_;
191  }
192 };
193 
194 } // namespace ethercatcpp
ethercatcpp::ShadowHand::print_fingers_positions
void print_fingers_positions()
Function used to print all fingers positions.
ethercatcpp::ShadowHand::read_raw_joints_positions
void read_raw_joints_positions()
read raw positions of hand's joints
ethercatcpp::ShadowHand::command_
shadow::RawHandCommand command_
Definition: shadow_hand.h:187
ethercatcpp::ShadowHand::state
const shadow::RawHandState & state() const
read only access to hand state
ethercatcpp::ShadowHand::~ShadowHand
~ShadowHand()
ethercatcpp::shadow::HandID
HandID
List of known Shadow hands with their respective serial number.
Definition: common.h:48
ethercatcpp::ShadowHand::read_biotacs_pressures
void read_biotacs_pressures()
read pressure of biotac sensors
ethercatcpp::ShadowHand::default_joint_calibrator
static std::unique_ptr< math::Interpolator< std::array< uint16_t, shadow::joint_count >, std::array< double, shadow::joint_count > > > default_joint_calibrator(shadow::HandID hand_id)
ethercatcpp::ShadowHand::write_joints_commands
void write_joints_commands()
write joints commands
ethercatcpp::ShadowHand::print_biotacs_data
void print_biotacs_data()
Function used to print all biotacs datas (presure, temperature and electrode impedance) for all finge...
ethercatcpp::ShadowHand::read_biotacs_temperatures
void read_biotacs_temperatures()
read temperatures of biotac sensors
ethercatcpp::ShadowHand::read_joints_positions
void read_joints_positions()
read positions of hand's joints
ethercatcpp::ShadowHand::write
void write()
write joints commands
ethercatcpp::ShadowHand::state_
shadow::RawHandState state_
Definition: shadow_hand.h:186
ethercatcpp::shadow::RawHandState
Definition: common.h:175
ethercatcpp::ShadowHand::read_biotacs_electrodes
void read_biotacs_electrodes()
read contact electrodes values of biotac sensors
ethercatcpp::BusDevice
This class define an EtherCAT bus device.
Definition: bus_device.h:49
ethercatcpp::ShadowHand::print_fingers_torques
void print_fingers_torques()
Function used to print all fingers torques.
ethercatcpp::ShadowHand::ShadowHand
ShadowHand(shadow::HandID hand_id, shadow::BiotacMode biotac_electrode_mode, shadow::ControlMode control_mode, std::unique_ptr< math::Interpolator< std::array< uint16_t, shadow::joint_count >, std::array< double, shadow::joint_count >>> joint_position_interpolator)
Constructor of ShadowHand class.
ethercatcpp::shadow::ControlMode
ControlMode
Describes the hand control mode: torque or direct PWM motor control.
Definition: common.h:78
ethercatcpp::ShadowHand::read_joints_torques
void read_joints_torques()
read torques of hand's joints
ethercatcpp::ShadowHand::command
const shadow::RawHandCommand & command() const
read only access to hand command
ethercatcpp::ShadowHand::impl_
std::unique_ptr< pImpl > impl_
Definition: shadow_hand.h:183
common.h
types needed to describe a shadow hand
core.h
Main header file for ethercatcpp-core.
ethercatcpp::shadow::RawHandCommand
Definition: common.h:193
ethercatcpp::shadow::BiotacMode
BiotacMode
Describes the Biotac working mode: with or without the electrodes.
Definition: common.h:71
ethercatcpp::ShadowHand
This class describe the full EtherCAT driver for the shadow hand.
Definition: shadow_hand.h:51
ethercatcpp
ethercatcpp::ShadowHand::read
void read()
read all hand state data
ethercatcpp::ShadowHand::impl
pImpl & impl()
Definition: shadow_hand.h:189