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
differential.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2013 LpzRobots development team *
3  * Authors: *
4  * Simón Smith <artificialsimon at ed dot ac dot uk> *
5  * Georg Martius <georg dot martius at web dot de> *
6  * *
7  * This program is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program; if not, write to the *
19  * Free Software Foundation, Inc., *
20  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  * *
22  ***************************************************************************/
23 
24 // Header guard
25 #ifndef __DIFFERENTIAL_H
26 #define __DIFFERENTIAL_H
27 
28 // Include ODE Robot class to inherit from it
29 #include <ode_robots/oderobot.h>
30 
31 // ODE primitives
32 #include <ode_robots/primitive.h>
33 
34 // ODE joints for objects
35 #include <ode_robots/joint.h>
36 
37 // ODE angular motors
38 #include <ode_robots/angularmotor.h>
39 
40 // ODE infrared distance sensors
41 #include <ode_robots/raysensorbank.h>
42 #include <ode_robots/irsensor.h>
43 
44 // Using name space lpzrobots
45 namespace lpzrobots{
46 
47  // structure to hold configuration of the robot
48  typedef struct{
49  double bodyRadius; // Radius of the cylinder defining the body
50  double bodyHeight; // Height of the cylinder defining the body
51  double bodyMass; // Mass of the body
52  double wheelRadius; // Radius of the cylinder defining the wheel
53  double wheelHeight; // Height of the cylinder defining the wheel
54  double wheelMass; // Mass of the wheel
55  double wheelMotorPower; // Maximum power allowed to the motor to reach MaxSpeed
56  double wheelMotorMaxSpeed; // Maximum speed of the wheel
57  double irRange; // Range (max distance) of the infra-red sensors
59 
60  /**
61  * Differential robot: two separated wheel on each side of the body
62  * Inherit from OdeRobot
63  */
64  class Differential: public OdeRobot {
65  public:
66  // Structure to hold the configuration of the robot
68 
69  /**
70  * Contrustructor
71  */
74  const std::string& name = "Differential");
75 
76  /**
77  * Default configuration of the robot
78  */
81  conf.bodyRadius = 1.;
82  conf.bodyHeight = .5;
83  conf.bodyMass = 1.;
84  conf.wheelRadius = .3;
85  conf.wheelHeight = .1;
86  conf.wheelMass = 5.;
87  conf.wheelMotorPower = 5.;
88  conf.wheelMotorMaxSpeed = 5.;
89  conf.irRange = 2.;
90  return conf;
91  }
92 
93  /**
94  * Destructor
95  */
96  virtual ~Differential();
97 
98  /**
99  * Place the robot in the desired pose
100  * @param pose desired 4x4 pose matrix
101  */
102  virtual void placeIntern(const osg::Matrix& pose) override;
103 
104  /**
105  * Create the robot in the desired pose
106  * @param pose desired 4x4 pose matrix
107  */
108  virtual void create(const osg::Matrix& pose);
109 
110  };
111 
112 
113 } // end namespace lpzrobots
114 
115 
116 // End of header guard
117 #endif
double wheelMotorMaxSpeed
Definition: differential.h:56
Data structure for accessing the ODE.
Definition: odehandle.h:44
Matrixd Matrix
Definition: osgforwarddecl.h:47
double irRange
Definition: differential.h:57
virtual ~Differential()
Destructor.
Definition: differential.cpp:37
Data structure for accessing the OpenSceneGraph.
Definition: osghandle.h:79
double wheelMotorPower
Definition: differential.h:55
double bodyHeight
Definition: differential.h:50
double bodyMass
Definition: differential.h:51
virtual void create(const osg::Matrix &pose)
Create the robot in the desired pose.
Definition: differential.cpp:51
DifferentialConf conf
Definition: differential.h:67
double bodyRadius
Definition: differential.h:49
double wheelRadius
Definition: differential.h:52
Definition: differential.h:48
OsgHandle osgHandle
Definition: oderobot.h:278
OdeHandle odeHandle
Definition: oderobot.h:277
Differential robot: two separated wheel on each side of the body Inherit from OdeRobot.
Definition: differential.h:64
Abstract class for ODE robots.
Definition: oderobot.h:64
double wheelMass
Definition: differential.h:54
static DifferentialConf getDefaultConf()
Default configuration of the robot.
Definition: differential.h:79
virtual void placeIntern(const osg::Matrix &pose) override
Place the robot in the desired pose.
Definition: differential.cpp:41
Differential(const OdeHandle &odeHandle, const OsgHandle &osgHandle, const DifferentialConf &conf=getDefaultConf(), const std::string &name="Differential")
Contrustructor.
Definition: differential.cpp:31
double wheelHeight
Definition: differential.h:53