SVHController.h
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 
00003 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00004 // This file is part of the SCHUNK SVH Driver suite.
00005 //
00006 // This program is free software licensed under the LGPL
00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
00008 // You can find a copy of this license in LICENSE folder in the top
00009 // directory of the source code.
00010 //
00011 // © Copyright 2014 SCHUNK Mobile Greifsysteme GmbH, Lauffen/Neckar Germany
00012 // © Copyright 2014 FZI Forschungszentrum Informatik, Karlsruhe, Germany
00013 //
00014 // -- END LICENSE BLOCK ------------------------------------------------
00015 
00016 //----------------------------------------------------------------------
00038 //----------------------------------------------------------------------
00039 #ifndef DRIVER_SVH_SVH_CONTROLLER_H_INCLUDED
00040 #define DRIVER_SVH_SVH_CONTROLLER_H_INCLUDED
00041 
00042 #include <driver_svh/ImportExport.h>
00043 #include <driver_svh/SVHSerialInterface.h>
00044 #include <driver_svh/SVHReceiveThread.h>
00045 #include <driver_svh/SVHControlCommand.h>
00046 #include <driver_svh/SVHControllerFeedback.h>
00047 #include <driver_svh/SVHCurrentSettings.h>
00048 #include <driver_svh/SVHFirmwareInfo.h>
00049 #include <driver_svh/SVHPositionSettings.h>
00050 #include <driver_svh/SVHControllerState.h>
00051 #include <driver_svh/SVHEncoderSettings.h>
00052 
00053 namespace driver_svh {
00054 
00056 enum{
00057   eSVH_ALL = -1,   // this should be used with care as not all functions support it yet
00058   eSVH_THUMB_FLEXION = 0,
00059   eSVH_THUMB_OPPOSITION, // wrist
00060   eSVH_INDEX_FINGER_DISTAL,
00061   eSVH_INDEX_FINGER_PROXIMAL,
00062   eSVH_MIDDLE_FINGER_DISTAL,
00063   eSVH_MIDDLE_FINGER_PROXIMAL,
00064   eSVH_RING_FINGER,
00065   eSVH_PINKY,
00066   eSVH_FINGER_SPREAD,
00067   eSVH_DIMENSION //9
00068 } typedef SVHChannel;
00069 
00077 class DRIVER_SVH_IMPORT_EXPORT SVHController
00078 {
00079 public:
00081   SVHController();
00082 
00086   ~SVHController();
00087 
00093   bool connect(const std::string &dev_name);
00094 
00096   void disconnect();
00097 
00103   void setControllerTarget(const SVHChannel& channel, const int32_t &position);
00104 
00109   void setControllerTargetAllChannels(const std::vector<int32_t>& positions);
00110 
00111 
00112   // Access functions
00117   void enableChannel(const SVHChannel& channel);
00118 
00123   void disableChannel(const SVHChannel& channel);
00124 
00126   void requestControllerState();
00127 
00132   void requestControllerFeedback(const SVHChannel& channel);
00133 
00138   void requestPositionSettings(const SVHChannel& channel);
00139 
00145   void setPositionSettings(const SVHChannel& channel,const SVHPositionSettings& position_settings);
00146 
00151   void requestCurrentSettings(const SVHChannel& channel);
00152 
00158   void setCurrentSettings(const SVHChannel& channel,const SVHCurrentSettings& current_settings);
00159 
00163   void requestEncoderValues();
00164 
00169   void setEncoderValues(const SVHEncoderSettings& encoder_settings);
00170 
00171 
00175   void requestFirmwareInfo();
00176 
00182   void receivedPacketCallback(const SVHSerialPacket& packet, unsigned int packet_count);
00183 
00195    bool getControllerFeedback(const SVHChannel &channel,SVHControllerFeedback& controller_feedback);
00196 
00203    bool getPositionSettings(const SVHChannel &channel,SVHPositionSettings& position_settings);
00204 
00211    bool getCurrentSettings(const SVHChannel &channel,SVHCurrentSettings& current_settings);
00212 
00217    SVHFirmwareInfo getFirmwareInfo();
00218 
00223    unsigned int getSentPackageCount();
00224 
00229    unsigned int getReceivedPackageCount();
00230 
00234    void resetPackageCounts();
00235 
00241    bool isEnabled(const SVHChannel &channel);
00242 
00244    static const char * m_channel_description[];
00245 
00247    static const float channel_effort_constants[9];
00248 
00250    void getControllerFeedbackAllChannels(SVHControllerFeedbackAllChannels &controller_feedback);
00251 private:
00252 
00253   // Data Structures for holding configurations and feedback of the Controller
00254 
00256   std::vector<SVHCurrentSettings> m_current_settings;
00257 
00259   std::vector<SVHPositionSettings> m_position_settings;
00260 
00262   std::vector<SVHControllerFeedback> m_controller_feedback;
00263 
00265   SVHControllerState m_controller_state;
00266 
00268   SVHEncoderSettings m_encoder_settings;
00269 
00271   SVHFirmwareInfo m_firmware_info;
00272 
00273   // Hardware control
00274 
00276   SVHSerialInterface * m_serial_interface;
00277 
00279   uint16_t m_enable_mask;
00280 
00282   unsigned int m_received_package_count;
00283 
00284 
00285 
00286 
00287 };
00288 
00289 }
00290 
00291 #endif


schunk_svh_driver
Author(s): Georg Heppner
autogenerated on Fri Aug 28 2015 12:59:19