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
copywiring.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 __COPYWIRING_H
25 #define __COPYWIRING_H
26 
27 #include <selforg/abstractwiring.h>
28 #include <selforg/matrix.h>
29 #include <list>
30 #include <vector>
31 
32 /** Implements a wiring where the motors are copied to several motors
33  and the sensors are fusioned.
34  */
35 class CopyWiring: public AbstractWiring {
36 public:
37  typedef std::vector < std::list<int> > Assignment;
38 
39  /** constructor
40  @param sensor_assignment for each controller sensor a list of robot sensor it is averaged over
41  @param motor_assignment for each robot motor a list of controller motors it is averaged over
42  @param noise NoiseGenerator that is used for adding noise to sensor values
43  @param plotMode see AbstractWiring
44  */
45  CopyWiring(const Assignment& sensor_assignment, const Assignment& motor_assignment,
46  NoiseGenerator* noise, int plotMode=Controller|Robot, const std::string& name = "CopyWiring");
47 
48  /** destructor
49  */
50  virtual ~CopyWiring();
51 
52  virtual void reset();
53 
54  static Assignment motorFromSensorAssignment(const Assignment& sensor_assignment);
55 
56 protected:
57 
58  /** initializes the number of sensors and motors on robot side, calculate
59  number of sensors and motors on controller side
60  */
61  virtual bool initIntern();
62 
63  /** Realizes one to one wiring from robot sensors to controller sensors.
64  @param rsensors pointer to array of sensorvalues from robot
65  @param rsensornumber number of sensors from robot
66  @param csensors pointer to array of sensorvalues for controller
67  @param csensornumber number of sensors to controller
68  @param noise size of the noise added to the sensors
69  */
70  virtual bool wireSensorsIntern(const sensor* rsensors, int rsensornumber,
71  sensor* csensors, int csensornumber,
72  double noise);
73 
74  /** Realizes one to one wiring from controller motor outputs to robot motors.
75  @param rmotors pointer to array of motorvalues for robot
76  @param rmotornumber number of robot motors
77  @param cmotors pointer to array of motorvalues from controller
78  @param cmotornumber number of motorvalues from controller
79  */
80  virtual bool wireMotorsIntern(motor* rmotors, int rmotornumber,
81  const motor* cmotors, int cmotornumber);
82 
83 
84 protected:
87 };
88 
89 #endif
int rmotornumber
number of motors at robot side
Definition: abstractwiring.h:182
virtual bool wireMotorsIntern(motor *rmotors, int rmotornumber, const motor *cmotors, int cmotornumber)
Realizes one to one wiring from controller motor outputs to robot motors.
Definition: copywiring.cpp:98
int csensornumber
number of sensors at controller side
Definition: abstractwiring.h:187
virtual bool initIntern()
initializes the number of sensors and motors on robot side, calculate number of sensors and motors on...
Definition: copywiring.cpp:58
int plotMode
using plotTypes this variables defines what is plotted
Definition: abstractwiring.h:168
Assignment m_assign
Definition: copywiring.h:86
virtual void reset()
reset internal state
Definition: copywiring.cpp:118
iparamkey name
Definition: inspectable.h:251
Implements a wiring where the motors are copied to several motors and the sensors are fusioned...
Definition: copywiring.h:35
Abstract wiring-object between controller and robot.
Definition: abstractwiring.h:39
Assignment s_assign
Definition: copywiring.h:85
std::vector< std::list< int > > Assignment
Definition: copywiring.h:37
CopyWiring(const Assignment &sensor_assignment, const Assignment &motor_assignment, NoiseGenerator *noise, int plotMode=Controller|Robot, const std::string &name="CopyWiring")
constructor
Definition: copywiring.cpp:35
double motor
Definition: abstractwiring.h:42
Definition: abstractwiring.h:44
int cmotornumber
number of motors at controller side
Definition: abstractwiring.h:192
Definition: abstractwiring.h:44
virtual bool wireSensorsIntern(const sensor *rsensors, int rsensornumber, sensor *csensors, int csensornumber, double noise)
Realizes one to one wiring from robot sensors to controller sensors.
Definition: copywiring.cpp:73
int rsensornumber
number of sensors at robot side
Definition: abstractwiring.h:177
double sensor
Definition: abstractwiring.h:41
static Assignment motorFromSensorAssignment(const Assignment &sensor_assignment)
returns the inverse Assignment of the given sensor assignemnt (typically the right thing) ...
Definition: copywiring.cpp:47
virtual ~CopyWiring()
destructor
Definition: copywiring.cpp:43
Interface and basic class for noise generator.
Definition: noisegenerator.h:37