2
* Robot3D Physical realistic 3D simulator for robots
4
* @license GNU Lesser General Public License
7
* @author Anne C. van Rossum
10
#include <srCore/actuator/wheelActuator.h>
15
WheelActuator::WheelActuator(const std::string name, const std::string type) :
16
ActuatorBase(name, type)
20
WheelActuator::~WheelActuator()
23
dJointDestroy(this->joint);
27
//! initializes the connector. Needs to be called before using the wheel.
28
void WheelActuator::init(dtCore::RefPtr<BodyBase> myBody1, dtCore::RefPtr<BodyBase> myBody2,
29
float anchorX, float anchorY, float anchorZ,
30
float axis1_X, float axis1_Y, float axis1_Z,
31
float axis2_X, float axis2_Y, float axis2_Z)
34
dWorldID worldID = myBody1->GetSceneParent()->GetWorldID();
36
//create Wheel using the Hinge2 joint
37
this->joint = dJointCreateHinge2(worldID, 0);
38
dJointAttach(this->joint, myBody1->GetBodyID(), myBody2->GetBodyID());
41
//set relation of the parts of the replicator
42
dJointSetHinge2Anchor(this->joint, anchorX, anchorY, anchorZ);
45
dJointSetHinge2Axis1(this->joint, axis1_X, axis1_Y, axis1_Z);
46
dJointSetHinge2Axis2(this->joint, axis2_X, axis2_Y, axis2_Z);
49
void WheelActuator::registerActuator()
52
ActuatorBase::jointActuatorMap.insert(std::pair<dJointID, ActuatorBase*>(this->getHinge(), this));
56
dJointID WheelActuator::getWheel() {
62
//! Sets ode parameters for the joint. For more Information, see www.ode.org/ode-latest-user-guide.org.
63
void WheelActuator::setODEParameter(int parameter, float value) {
65
dJointSetHinge2Param(this->joint, parameter, value);