SVHFeedbackPollingThread.cpp
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 //----------------------------------------------------------------------
00029 //----------------------------------------------------------------------
00030 #include <driver_svh/Logging.h>
00031 #include <driver_svh/SVHFingerManager.h>
00032 
00033 namespace driver_svh {
00034 
00035 SVHFeedbackPollingThread::SVHFeedbackPollingThread(const TimeSpan& period, SVHFingerManager* finger_manager)
00036   : PeriodicThread("SVHReceiveThread", period),
00037     m_finger_manager(finger_manager)
00038 {
00039 }
00040 
00041 void SVHFeedbackPollingThread::run()
00042 {
00043   while (execute())
00044   {
00045     if (m_finger_manager != NULL)
00046     {
00047       if (m_finger_manager->isConnected())
00048       {
00049         m_finger_manager->requestControllerFeedback(eSVH_ALL);
00050 
00051         // This would inform a websocket server about new states, disregard that.
00052         #ifdef _IC_BUILDER_ICL_COMM_WEBSOCKET_
00053         m_finger_manager->updateWebSocket();
00054         #endif // _IC_BUILDER_ICL_COMM_WEBSOCKET_
00055       }
00056       else
00057       {
00058         LOGGING_WARNING_C(DriverSVH, SVHFeedbackPollingThread, "SCHUNK five finger hand is not connected!" << endl);
00059       }
00060     }
00061     else
00062     {
00063       LOGGING_WARNING_C(DriverSVH, SVHFeedbackPollingThread, "Pointer to FingerManager is NULL!" << endl);
00064     }
00065 
00066     // Wait for the thread period so that the timing is in sync.
00067     waitPeriod();
00068   }
00069 }
00070 
00071 }


schunk_svh_driver
Author(s): Georg Heppner
autogenerated on Fri Apr 28 2017 02:31:08