~robot3d-team/robot3d/trunk

« back to all changes in this revision

Viewing changes to src/srActuator/WheelUniKarl.cpp

  • Committer: Anne van Rossum
  • Date: 2010-08-10 15:58:55 UTC
  • Revision ID: anne@gamix-20100810155855-kve7x2vwouagdij9
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Robot3D Physical realistic 3D simulator for robots
 
3
 *
 
4
 * @license GNU Lesser General Public License
 
5
 *
 
6
 * @author Lutz Winkler
 
7
 * @author Anne C. van Rossum
 
8
 */
 
9
#include <srActuator/WheelUniKarl.h>
 
10
 
 
11
// for CFM and ERP, read the manual of the ODE:
 
12
// http://www.ode.org/ode-latest-userguide.html
 
13
#define SUSPENSION_ERP                  0.9                                     //0.8
 
14
#define SUSPENSION_CFM                  0.3                                     //0.6
 
15
#define STOP_ERP                                0.9                                     //0.8
 
16
#define STOP_CFM                                0.3                                     //0.6
 
17
 
 
18
#define FUDGE                                   0.5
 
19
#define BOUNCE                                  0.0
 
20
 
 
21
#define PI                                              3.1415
 
22
 
 
23
// Torques are in N*(5cm).              1Nm ^= 20N*(5cm)
 
24
#define MAX_TORQUE                              1000
 
25
 
 
26
namespace srCore {
 
27
//! Constructor
 
28
/*! @param body1, body2 the bodies the hinge is attached to.
 
29
 *      @param anchorX, anchorY, anchorZ the position of the hinge in the world coordinate system.
 
30
 *  @param axisX, axisY, axisZ the orientation of the axis of the hinge in the world coordinate system.
 
31
 *
 
32
 */
 
33
WheelUniKarl::WheelUniKarl(dtCore::RefPtr<BodyBase> body1, dtCore::RefPtr<BodyBase> body2,
 
34
                                        float anchorX, float anchorY, float anchorZ,
 
35
                                        float axis1_X, float axis1_Y, float axis1_Z,
 
36
                                        const std::string &name) :
 
37
                                                HingeActuator(name, "ukaWheel")
 
38
 
 
39
{
 
40
 
 
41
        this->init(     body1, body2,
 
42
                                anchorX, anchorY, anchorZ,
 
43
                                axis1_X, axis1_Y, axis1_Z);
 
44
 
 
45
        //set up wheel joint
 
46
//      setParam(dParamLoStop, -PI);
 
47
//      setParam(dParamHiStop, PI);
 
48
        //setParam(dParamSuspensionERP, SUSPENSION_ERP);
 
49
        //setParam(dParamSuspensionCFM, SUSPENSION_CFM);
 
50
        setODEParameter(dParamStopERP, STOP_ERP);
 
51
        setODEParameter(dParamStopCFM, STOP_CFM);
 
52
        setODEParameter(dParamFudgeFactor, FUDGE);
 
53
        setODEParameter(dParamBounce, BOUNCE);
 
54
        setODEParameter(dParamFMax, MAX_TORQUE);
 
55
 
 
56
        dJointSetHingeParam (joint, dParamLoStop, -4);
 
57
        dJointSetHingeParam (joint, dParamHiStop, 4);
 
58
 
 
59
}
 
60
 
 
61
WheelUniKarl::~WheelUniKarl()
 
62
{
 
63
}
 
64
 
 
65
}