Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
motor.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2011 LpzRobots development team *
3  * Georg Martius <georg dot martius at web dot de> *
4  * Frank Guettler <guettler at informatik dot uni-leipzig dot de *
5  * Frank Hesse <frank at nld dot ds dot mpg dot de> *
6  * Ralf Der <ralfder at mis dot mpg dot de> *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program 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 *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22  * *
23  ***************************************************************************/
24 #ifndef MOTOR_H_
25 #define MOTOR_H_
26 
27 #include "globaldata.h"
28 #include "sensormotorinfoable.h"
29 
30 namespace lpzrobots {
31 
32  /**
33  Abstact base class for attachable motors
34  */
35  class Motor : public virtual SensorMotorInfoAble {
36  public:
37  Motor() {
38  }
39  virtual ~Motor() {};
40 
41  /** initialises motor with body of robot
42  */
43  virtual void init(Primitive* own, Joint* joint = 0)=0;
44 
45  /// return the dimensionality of this motor
46  virtual int getMotorNumber() const =0;
47 
48  /** returns a list of motor names (@see SensorMotorNaming how to change the names) */
49  virtual std::list<SensorMotorInfo> getMotorInfos() const {
50  return getInfos(getMotorNumber());
51  };
52 
53  /** performs the actions, This is usually called in
54  doInternalStuff() from the robot */
55  virtual bool act(GlobalData& globaldata) = 0;
56 
57  /** sends the action commands to the motor.
58  It returns the number of used values. (should be equal to
59  getMotorNumber)
60  */
61  virtual int set(const motor* values, int length) = 0;
62  };
63 }
64 
65 #endif /* !MOTOR_H_ */
virtual int set(const motor *values, int length)=0
sends the action commands to the motor.
virtual bool act(GlobalData &globaldata)=0
performs the actions, This is usually called in doInternalStuff() from the robot
Definition: joint.h:41
Abstact base class for attachable motors.
Definition: motor.h:35
virtual std::list< SensorMotorInfo > getMotorInfos() const
returns a list of motor names (
Definition: motor.h:49
Interface class for primitives represented in the physical and graphical world.
Definition: primitive.h:80
Data structure holding all essential global information.
Definition: globaldata.h:57
virtual void init(Primitive *own, Joint *joint=0)=0
initialises motor with body of robot
double motor
Definition: types.h:30
Motor()
Definition: motor.h:37
virtual ~Motor()
Definition: motor.h:39
Abstract class for giving names to sensors and motors.
Definition: sensormotorinfoable.h:37
std::list< SensorMotorInfo > getInfos(int number) const
get all infos.
Definition: sensormotorinfoable.h:81
virtual int getMotorNumber() const =0
return the dimensionality of this motor