SVHController.h
Go to the documentation of this file.
1 //
3 // © Copyright 2022 SCHUNK Mobile Greifsysteme GmbH, Lauffen/Neckar Germany
4 // © Copyright 2022 FZI Forschungszentrum Informatik, Karlsruhe, Germany
5 //
6 // This file is part of the Schunk SVH Library.
7 //
8 // The Schunk SVH Library is free software: you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation, either version 3 of the License, or (at your
11 // option) any later version.
12 //
13 // The Schunk SVH Library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16 // Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License along with
19 // the Schunk SVH Library. If not, see <https://www.gnu.org/licenses/>.
20 //
22 
23 
24 //----------------------------------------------------------------------
46 //----------------------------------------------------------------------
47 #ifndef DRIVER_SVH_SVH_CONTROLLER_H_INCLUDED
48 #define DRIVER_SVH_SVH_CONTROLLER_H_INCLUDED
49 
60 
61 namespace driver_svh {
62 
65 enum
66 {
67  SVH_ALL = -1, // this should be used with care as not all functions support it yet
78 } typedef SVHChannel;
79 
88 {
89 public:
91  SVHController();
92 
96  ~SVHController();
97 
103  bool connect(const std::string& dev_name);
104 
106  void disconnect();
107 
113  void setControllerTarget(const SVHChannel& channel, const int32_t& position);
114 
119  void setControllerTargetAllChannels(const std::vector<int32_t>& positions);
120 
121 
122  // Access functions
127  void enableChannel(const SVHChannel& channel);
128 
133  void disableChannel(const SVHChannel& channel);
134 
136  void requestControllerState();
137 
142  void requestControllerFeedback(const SVHChannel& channel);
143 
148  void requestPositionSettings(const SVHChannel& channel);
149 
155  void setPositionSettings(const SVHChannel& channel, const SVHPositionSettings& position_settings);
156 
161  void requestCurrentSettings(const SVHChannel& channel);
162 
168  void setCurrentSettings(const SVHChannel& channel, const SVHCurrentSettings& current_settings);
169 
173  void requestEncoderValues();
174 
179  void setEncoderValues(const SVHEncoderSettings& encoder_settings);
180 
181 
185  void requestFirmwareInfo();
186 
192  void receivedPacketCallback(const SVHSerialPacket& packet, unsigned int packet_count);
193 
205  bool getControllerFeedback(const SVHChannel& channel, SVHControllerFeedback& controller_feedback);
206 
213  bool getPositionSettings(const SVHChannel& channel, SVHPositionSettings& position_settings);
214 
221  bool getCurrentSettings(const SVHChannel& channel, SVHCurrentSettings& current_settings);
222 
227  SVHFirmwareInfo getFirmwareInfo();
228 
233  unsigned int getSentPackageCount();
234 
240  unsigned int getReceivedPackageCount();
241 
245  void resetPackageCounts();
246 
252  bool isEnabled(const SVHChannel& channel);
253 
255  static const char* m_channel_description[];
256 
258  static const float CHANNEL_EFFORT_CONSTANTS[9][2];
259 
261  void getControllerFeedbackAllChannels(SVHControllerFeedbackAllChannels& controller_feedback);
262 
263 private:
264  // Data Structures for holding configurations and feedback of the Controller
265 
267  std::vector<SVHCurrentSettings> m_current_settings;
268 
270  std::vector<SVHPositionSettings> m_position_settings;
271 
273  std::vector<SVHControllerFeedback> m_controller_feedback;
274 
277 
280 
283 
284  // Hardware control
285 
288 
290  uint16_t m_enable_mask;
291 
295 };
296 
297 } // namespace driver_svh
298 
299 #endif
driver_svh::SVHController::m_controller_state
SVHControllerState m_controller_state
Currently active controllerstate on the HW Controller (indicates if PWM active etc....
Definition: SVHController.h:276
SVHCurrentSettings.h
driver_svh::SVHSerialPacket
The SerialPacket holds the (non generated) header and data of one message to the SVH-Hardware.
Definition: SVHSerialPacket.h:80
SVHControllerFeedback.h
driver_svh::SVHController::m_position_settings
std::vector< SVHPositionSettings > m_position_settings
vector of position controller parameters for each finger
Definition: SVHController.h:270
receivedPacketCallback
void receivedPacketCallback(const SVHSerialPacket &packet, unsigned int packet_count)
Definition: SVHReceiveFeedbackPacketTest.cpp:45
SVHEncoderSettings.h
driver_svh::SVHControllerFeedbackAllChannels
The SVHControllerFeedbackAllChannes saves the feedback of a all motors.
Definition: SVHControllerFeedback.h:73
SVHSerialInterface.h
driver_svh::SVHController::m_enable_mask
uint16_t m_enable_mask
Bitmask to tell which fingers are enabled.
Definition: SVHController.h:290
driver_svh::SVH_ALL
@ SVH_ALL
Definition: SVHController.h:67
driver_svh::SVH_FINGER_SPREAD
@ SVH_FINGER_SPREAD
Definition: SVHController.h:76
driver_svh::SVH_DIMENSION
@ SVH_DIMENSION
Definition: SVHController.h:77
driver_svh::SVH_MIDDLE_FINGER_PROXIMAL
@ SVH_MIDDLE_FINGER_PROXIMAL
Definition: SVHController.h:73
driver_svh
Definition: SVHControlCommand.h:39
SVHReceiveThread.h
driver_svh::SVHController
This class controls the the SCHUNK five finger hand.
Definition: SVHController.h:87
driver_svh::SVHControllerState
The SVHControllerState indicates the current state of the MeCoVis controller IC which is used in the ...
Definition: SVHControllerState.h:47
driver_svh::SVHController::m_serial_interface
SVHSerialInterface * m_serial_interface
Serial interface for transmission and reveibing of data packets.
Definition: SVHController.h:287
driver_svh::SVH_PINKY
@ SVH_PINKY
Definition: SVHController.h:75
SVHFirmwareInfo.h
driver_svh::SVHCurrentSettings
The SVHCurrentSettings save the current controller paramters for a single motor.
Definition: SVHCurrentSettings.h:44
driver_svh::SVHController::m_encoder_settings
SVHEncoderSettings m_encoder_settings
Currently active encoder settings.
Definition: SVHController.h:279
driver_svh::SVHFirmwareInfo
The SVHFirmwareInfo holds the data of a firmware response from the hardware.
Definition: SVHFirmwareInfo.h:48
driver_svh::SVHControllerFeedback
The SVHControllerFeedback saves the feedback of a single motor.
Definition: SVHControllerFeedback.h:45
driver_svh::SVHEncoderSettings
The SVHEncoderSettings hold the settings for the encoder scaling of each channel.
Definition: SVHEncoderSettings.h:46
SVHControllerState.h
driver_svh::SVHController::m_firmware_info
SVHFirmwareInfo m_firmware_info
Latest firmware info.
Definition: SVHController.h:282
DRIVER_SVH_IMPORT_EXPORT
#define DRIVER_SVH_IMPORT_EXPORT
Definition: ImportExport.h:50
driver_svh::SVHChannel
SVHChannel
Definition: SVHController.h:65
driver_svh::SVH_RING_FINGER
@ SVH_RING_FINGER
Definition: SVHController.h:74
driver_svh::SVHController::m_current_settings
std::vector< SVHCurrentSettings > m_current_settings
vector of current controller parameters for each finger
Definition: SVHController.h:267
SVHControlCommand.h
SVHPositionSettings.h
driver_svh::SVH_THUMB_FLEXION
@ SVH_THUMB_FLEXION
Definition: SVHController.h:68
driver_svh::SVHController::m_received_package_count
unsigned int m_received_package_count
Definition: SVHController.h:294
driver_svh::SVHPositionSettings
The SVHPositionSettings save the position controller paramters for a single motor.
Definition: SVHPositionSettings.h:44
driver_svh::SVH_MIDDLE_FINGER_DISTAL
@ SVH_MIDDLE_FINGER_DISTAL
Definition: SVHController.h:72
ImportExport.h
driver_svh::SVH_THUMB_OPPOSITION
@ SVH_THUMB_OPPOSITION
Definition: SVHController.h:69
driver_svh::SVHSerialInterface
Basic communication handler for the SCHUNK five finger hand.
Definition: SVHSerialInterface.h:57
driver_svh::SVH_INDEX_FINGER_DISTAL
@ SVH_INDEX_FINGER_DISTAL
Definition: SVHController.h:70
driver_svh::SVHController::m_controller_feedback
std::vector< SVHControllerFeedback > m_controller_feedback
ControllerFeedback indicates current position and current per finger.
Definition: SVHController.h:273
driver_svh::SVH_INDEX_FINGER_PROXIMAL
@ SVH_INDEX_FINGER_PROXIMAL
Definition: SVHController.h:71


schunk_svh_library
Author(s): Georg Heppner, Lars Pfotzer, Felix Exner, Johannes Mangler, Stefan Scherzinger, Pascal Becker
autogenerated on Fri Apr 14 2023 02:53:52