00001 /*************************************************************************** 00002 * Copyright (C) 2005-2011 LpzRobots development team * 00003 * Georg Martius <georg dot martius at web dot de> * 00004 * Frank Guettler <guettler at informatik dot uni-leipzig dot de * 00005 * Frank Hesse <frank at nld dot ds dot mpg dot de> * 00006 * Ralf Der <ralfder at mis dot mpg dot de> * 00007 * * 00008 * This program is free software; you can redistribute it and/or modify * 00009 * it under the terms of the GNU General Public License as published by * 00010 * the Free Software Foundation; either version 2 of the License, or * 00011 * (at your option) any later version. * 00012 * * 00013 * This program is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00016 * GNU General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU General Public License * 00019 * along with this program; if not, write to the * 00020 * Free Software Foundation, Inc., * 00021 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00022 * * 00023 ***************************************************************************/ 00024 #ifndef __TORQUESENSOR_H 00025 #define __TORQUESENSOR_H 00026 00027 #include "sensor.h" 00028 #include <ode-dbl/ode.h> 00029 00030 namespace lpzrobots { 00031 00032 class Joint; 00033 00034 /** Class for sensing the torque that are applied the joint by a motor. 00035 The sensor value can be interpretedas a motor current. 00036 */ 00037 class TorqueSensor : public Sensor { 00038 public: 00039 00040 /** 00041 @param joint the joint on which to measure the torques. 00042 @param maxtorque at this torque the sensor value is 1. 00043 */ 00044 TorqueSensor(Joint* joint, double maxtorque = 1.0); 00045 virtual ~TorqueSensor(); 00046 00047 /// the primitive is not required here, set it to NULL 00048 virtual void init(Primitive* own); 00049 virtual int getSensorNumber() const; 00050 00051 virtual bool sense(const GlobalData& globaldata); 00052 virtual std::list<sensor> get() const; 00053 00054 private: 00055 Joint* joint; 00056 double maxtorque; 00057 dJointFeedback* feedback; 00058 bool allocatedfb; 00059 }; 00060 00061 00062 } 00063 00064 #endif
1.6.3