Exemplo n.º 1
0
void Apex::LoadDynamicTriangleMesh(int numVerts, PxVec3* verts, ObjectInfo info)
{
	PxRigidDynamic* meshActor = mPhysics->createRigidDynamic(PxTransform::createIdentity());
	PxShape* meshShape, *convexShape;
	if(meshActor)
	{
		//meshActor->setRigidDynamicFlag(PxRigidDynamicFlag::eKINEMATIC, true);

		PxTriangleMeshDesc meshDesc;
		meshDesc.points.count           = numVerts;
		meshDesc.points.stride          = sizeof(PxVec3);
		meshDesc.points.data            = verts;

		//meshDesc.triangles.count        = numInds/3.;
		//meshDesc.triangles.stride       = 3*sizeof(int);
		//meshDesc.triangles.data         = inds;

		PxToolkit::MemoryOutputStream writeBuffer;
		bool status = mCooking->cookTriangleMesh(meshDesc, writeBuffer);
		if(!status)
			return;

		PxToolkit::MemoryInputData readBuffer(writeBuffer.getData(), writeBuffer.getSize());

		PxTriangleMeshGeometry triGeom;
		triGeom.triangleMesh = mPhysics->createTriangleMesh(readBuffer);
		//triGeom.scale = PxMeshScale(PxVec3(info.sx,info.sy,info.sz),physx::PxQuat::createIdentity());
		
		meshShape = meshActor->createShape(triGeom, *defaultMaterial);
		//meshShape->setLocalPose(PxTransform(PxVec3(info.x,info.y,info.z)));
		meshShape->setFlag(PxShapeFlag::eUSE_SWEPT_BOUNDS, true);

		PxConvexMeshDesc convexDesc;
		convexDesc.points.count     = numVerts;
		convexDesc.points.stride    = sizeof(PxVec3);
		convexDesc.points.data      = verts;
		convexDesc.flags            = PxConvexFlag::eCOMPUTE_CONVEX;

		if(!convexDesc.isValid())
			return;
		PxToolkit::MemoryOutputStream buf;
		if(!mCooking->cookConvexMesh(convexDesc, buf))
			return;
		PxToolkit::MemoryInputData input(buf.getData(), buf.getSize());
		PxConvexMesh* convexMesh = mPhysics->createConvexMesh(input);
		PxConvexMeshGeometry convexGeom = PxConvexMeshGeometry(convexMesh);
		convexShape = meshActor->createShape(convexGeom, *defaultMaterial);
		//convexShape->setLocalPose(PxTransform(PxVec3(info.x,info.y,info.z)));
		//convexShape->setFlag(PxShapeFlag::eSIMULATION_SHAPE, false);

		
		convexShape->setFlag(PxShapeFlag::eSIMULATION_SHAPE, true);
		meshShape->setFlag(PxShapeFlag::eSIMULATION_SHAPE, false);
		meshActor->setRigidDynamicFlag(PxRigidDynamicFlag::eKINEMATIC, false);

		meshActor->setGlobalPose(PxTransform(PxVec3(info.x,info.y,info.z), PxQuat(info.ry, PxVec3(0.0f,1.0f,0.0f))));
		mScene[mCurrentScene]->addActor(*meshActor);
		dynamicActors.push_back(meshActor);
	}
}
Exemplo n.º 2
0
PxRigidDynamic* Vehicle::createVehicleActor(const PxVehicleChassisData& chassisData,
	PxMaterial** wheelMaterials, PxConvexMesh** wheelConvexMeshes, const PxU32 numWheels,
	PxMaterial** chassisMaterials, PxConvexMesh** chassisConvexMeshes, const PxU32 numChassisMeshes, PxPhysics& physics, PxVec3 initPos)
{
	//We need a rigid body actor for the vehicle.
	//Don't forget to add the actor to the scene after setting up the associated vehicle.
	PxRigidDynamic* vehActor = physics.createRigidDynamic(PxTransform(initPos));
	vehActor->setRigidBodyFlag(PxRigidBodyFlag::eENABLE_CCD, true);

	//Wheel and chassis simulation filter data.
	PxFilterData wheelSimFilterData;
	wheelSimFilterData.word0 = COLLISION_FLAG_WHEEL;
	wheelSimFilterData.word1 = COLLISION_FLAG_WHEEL_AGAINST;
	PxFilterData chassisSimFilterData;
	chassisSimFilterData.word0 = COLLISION_FLAG_CHASSIS;
	chassisSimFilterData.word1 = COLLISION_FLAG_CHASSIS_AGAINST;

	//Wheel and chassis query filter data.
	//Optional: cars don't drive on other cars.
	PxFilterData wheelQryFilterData;
	wheelQryFilterData.word0 = FilterGroup::eWHEEL;
	setupNonDrivableSurface(wheelQryFilterData);
	PxFilterData chassisQryFilterData;
	chassisQryFilterData.word0 = FilterGroup::eVEHICLE;

	setupNonDrivableSurface(chassisQryFilterData);

	//Add all the wheel shapes to the actor.
	for (PxU32 i = 0; i < numWheels; i++)
	{
		PxConvexMeshGeometry geom(wheelConvexMeshes[i]);
		PxShape* wheelShape = vehActor->createShape(geom, *wheelMaterials[i]);
		wheelShape->setQueryFilterData(wheelQryFilterData);
		wheelShape->setSimulationFilterData(wheelSimFilterData);
		wheelShape->setLocalPose(PxTransform(PxIdentity));
	}

	//Add the chassis shapes to the actor.
	for (PxU32 i = 0; i < numChassisMeshes; i++)
	{
		PxShape* chassisShape = vehActor->createShape
			(PxConvexMeshGeometry(chassisConvexMeshes[i]), *chassisMaterials[i]);
		chassisShape->setQueryFilterData(chassisQryFilterData);
		chassisShape->setSimulationFilterData(chassisSimFilterData);
		chassisShape->setLocalPose(PxTransform(PxIdentity));
	}

	vehActor->setMass(chassisData.mMass);
	vehActor->setMassSpaceInertiaTensor(chassisData.mMOI);
	vehActor->setCMassLocalPose(PxTransform(chassisData.mCMOffset, PxQuat(PxIdentity)));

	return vehActor;
}
Exemplo n.º 3
0
	PxGeometry& Camera::getPixelFrustum(FDreal pixelXSize, FDreal pixelYSize) {
		
		if (pixelFrustum.isValid()) {
			return pixelFrustum;
		}

		Vector3 proj1(-pixelXSize / 2, -pixelYSize / 2, 1);
		Vector3 proj2(-pixelXSize / 2, pixelYSize / 2, 1);
		Vector3 proj3(pixelXSize / 2, -pixelYSize / 2, 1);
		Vector3 proj4(pixelXSize / 2, pixelYSize / 2, 1);

		fdmath::Matrix44 projInverse;
		fdmath::gluInvertMatrix44(projection, projInverse);

		FDreal len = -100.0f;
		Vector3 view1 = projInverse.transform(proj1).getNormalized() * len;
		Vector3 view2 = projInverse.transform(proj2).getNormalized() * len;
		Vector3 view3 = projInverse.transform(proj3).getNormalized() * len;
		Vector3 view4 = projInverse.transform(proj4).getNormalized() * len;

		static const PxVec3 convexVerts[] = {PxVec3(0,0,0), view1, 
				view2, view3, view4};

		PhysicsSystem* physics = FreeThread__getWorld().
				getSystem<PhysicsSystem>();

		PxConvexMeshDesc convexDesc;
		convexDesc.points.count     = 5;
		convexDesc.points.stride    = sizeof(PxVec3);
		convexDesc.points.data      = convexVerts;
		convexDesc.flags            = PxConvexFlag::eCOMPUTE_CONVEX;
		convexDesc.vertexLimit      = 256;

		PxDefaultMemoryOutputStream buf;
		if (!physics->cooking->cookConvexMesh(convexDesc, buf)) {
			FD_THROW(GenericException("Unable to cook convex pixel mesh!"));
		}
		PxDefaultMemoryInputData input(buf.getData(), buf.getSize());
		PxConvexMesh* convexMesh = physics->physics->createConvexMesh(input);

		pixelFrustum = PxConvexMeshGeometry(convexMesh);

		return pixelFrustum;
	}
void rm3d::ai::WheelbotModule::init (const PxTransform& transform) {
    this->executionDelay = 0;
    WheelbotSimBase *rsim = (WheelbotSimBase *) this->sim;
    this->firstStep = true;
    vector<PxVec3> bodyVecs;
    vector<PxVec3> wheelVecs;
    float wheelRadiusInc = wheelbotWheelRadius/pointsPerRadius;
    float circleIncCountWheel = 0.0;
    bodyVecs.push_back(PxVec3(wheelbotHalfWidth, wheelbotHalfHeight, wheelbotHalfDepth));
    bodyVecs.push_back(PxVec3(wheelbotHalfWidth, wheelbotHalfHeight, -wheelbotHalfDepth));
    bodyVecs.push_back(PxVec3(wheelbotHalfWidth, -wheelbotHalfHeight, wheelbotHalfDepth));
    bodyVecs.push_back(PxVec3(wheelbotHalfWidth, -wheelbotHalfHeight, -wheelbotHalfDepth));
    bodyVecs.push_back(PxVec3(-wheelbotHalfWidth, wheelbotHalfHeight, wheelbotHalfDepth));
    bodyVecs.push_back(PxVec3(-wheelbotHalfWidth, wheelbotHalfHeight, -wheelbotHalfDepth));
    bodyVecs.push_back(PxVec3(-wheelbotHalfWidth, -wheelbotHalfHeight, wheelbotHalfDepth));
    bodyVecs.push_back(PxVec3(-wheelbotHalfWidth, -wheelbotHalfHeight, -wheelbotHalfDepth));
    while (circleIncCountWheel <= wheelbotWheelRadius) {
        if (circleIncCountWheel == 0) {
            wheelVecs.push_back(PxVec3(0,wheelbotWheelRadius,wheelbotHalfWheelDepth));
            wheelVecs.push_back(PxVec3(0,wheelbotWheelRadius,-wheelbotHalfWheelDepth));
            wheelVecs.push_back(PxVec3(0,-wheelbotWheelRadius,wheelbotHalfWheelDepth));
            wheelVecs.push_back(PxVec3(0,-wheelbotWheelRadius,-wheelbotHalfWheelDepth));
        } else if (circleIncCountWheel == wheelbotWheelRadius) {
            wheelVecs.push_back(PxVec3(wheelbotWheelRadius,0,wheelbotHalfWheelDepth));
            wheelVecs.push_back(PxVec3(wheelbotWheelRadius,0,-wheelbotHalfWheelDepth));
            wheelVecs.push_back(PxVec3(-wheelbotWheelRadius,0,wheelbotHalfWheelDepth));
            wheelVecs.push_back(PxVec3(-wheelbotWheelRadius,0,-wheelbotHalfWheelDepth));
        } else {
            wheelVecs.push_back(PxVec3(wheelbotWheelRadius - circleIncCountWheel,sqrt(powf(wheelbotWheelRadius,2.0) - powf(wheelbotWheelRadius - circleIncCountWheel, 2.0)),-wheelbotHalfWheelDepth));
            wheelVecs.push_back(PxVec3(wheelbotWheelRadius - circleIncCountWheel,-sqrt(powf(wheelbotWheelRadius,2.0) - powf(wheelbotWheelRadius - circleIncCountWheel, 2.0)),-wheelbotHalfWheelDepth));
            wheelVecs.push_back(PxVec3(-wheelbotWheelRadius + circleIncCountWheel,sqrt(powf(wheelbotWheelRadius,2.0) - powf(-wheelbotWheelRadius + circleIncCountWheel, 2.0)),-wheelbotHalfWheelDepth));
            wheelVecs.push_back(PxVec3(-wheelbotWheelRadius + circleIncCountWheel,-sqrt(powf(wheelbotWheelRadius,2.0) - powf(-wheelbotWheelRadius + circleIncCountWheel, 2.0)),-wheelbotHalfWheelDepth));
            wheelVecs.push_back(PxVec3(wheelbotWheelRadius - circleIncCountWheel,sqrt(powf(wheelbotWheelRadius,2.0) - powf(wheelbotWheelRadius - circleIncCountWheel, 2.0)),wheelbotHalfWheelDepth));
            wheelVecs.push_back(PxVec3(wheelbotWheelRadius - circleIncCountWheel,-sqrt(powf(wheelbotWheelRadius,2.0) - powf(wheelbotWheelRadius - circleIncCountWheel, 2.0)),wheelbotHalfWheelDepth));
            wheelVecs.push_back(PxVec3(-wheelbotWheelRadius + circleIncCountWheel,sqrt(powf(wheelbotWheelRadius,2.0) - powf(-wheelbotWheelRadius + circleIncCountWheel, 2.0)),wheelbotHalfWheelDepth));
            wheelVecs.push_back(PxVec3(-wheelbotWheelRadius + circleIncCountWheel,-sqrt(powf(wheelbotWheelRadius,2.0) - powf(-wheelbotWheelRadius + circleIncCountWheel, 2.0)),wheelbotHalfWheelDepth));
        }
        
        circleIncCountWheel += wheelRadiusInc;
    }
    //Convex mesh for inner shapes
    WheelbotSimBase * simulator = (WheelbotSimBase *) sim;
    PxConvexMesh *bodyMesh = rm3d::SimulationUtility::GenerateConvex(*(simulator->getSimulationPhysics()),*simulator->getSimulationCooking(), bodyVecs.size(), &bodyVecs[0]);
    PxConvexMesh *wheelMesh = rm3d::SimulationUtility::GenerateConvex(*(simulator->getSimulationPhysics()),*simulator->getSimulationCooking(), wheelVecs.size(), &wheelVecs[0]);
    bodyMaterial = simulator->getSimulationPhysics()->createMaterial(wheelbotStaticFrictionBody,wheelbotDynamicFrictionBody,wheelbotRestitutionBody);
    wheelMaterial = simulator->getSimulationPhysics()->createMaterial(wheelbotStaticFrictionWheel,wheelbotDynamicFrictionWheel,wheelbotRestitutionWheel);
    wheelbot = simulator->getSimulationPhysics()->createArticulation();
    body = wheelbot->createLink(NULL, transform);
    bodyShape = body->createShape(PxConvexMeshGeometry(bodyMesh), *bodyMaterial);
    bodyShape->setLocalPose(PxTransform(PxVec3(0), PxQuat(PxHalfPi, PxVec3(1,0,0))));
    leftFrontWheel = wheelbot->createLink(body, transform*PxTransform(PxVec3(wheelbotHalfWidth,0,-wheelbotHalfHeight - wheelbotWheelDepth/2.0),
                                                                      PxQuat(0, PxVec3(0,1,0))));
    leftFrontWheelShape = leftFrontWheel->createShape(PxConvexMeshGeometry(wheelMesh),*wheelMaterial);
    
    leftBackWheel = wheelbot->createLink(body,transform*PxTransform(PxVec3(-wheelbotHalfWidth,0,-wheelbotHalfHeight - wheelbotWheelDepth/2.0),
                                                                    PxQuat(0, PxVec3(0,1,0))));
    leftBackWheelShape = leftBackWheel->createShape(PxConvexMeshGeometry(wheelMesh),*wheelMaterial);
    
    rightFrontWheel = wheelbot->createLink(body, transform*PxTransform(PxVec3(wheelbotHalfWidth,0,wheelbotHalfHeight + wheelbotWheelDepth/2.0),
                                                                       PxQuat(0, PxVec3(0,1,0))));
    rightFrontWheelShape = rightFrontWheel->createShape(PxConvexMeshGeometry(wheelMesh),*wheelMaterial);
    
    rightBackWheel = wheelbot->createLink(body, transform*PxTransform(PxVec3(-wheelbotHalfWidth,0,wheelbotHalfHeight + wheelbotWheelDepth/2.0),
                                                                      PxQuat(0, PxVec3(0,1,0))));
    rightBackWheelShape = rightBackWheel->createShape(PxConvexMeshGeometry(wheelMesh),*wheelMaterial);
    
    this->bodyString = this->name + "Body";
    this->frontLeftWheelString = this->name + "FL";
    this->backLeftWheelString = this->name + "RL";
    this->backRightWheelString = this->name + "RR";
    this->frontRightWheelString = this->name + "FR";
    //set names for shapes
    body->setName(bodyString.c_str());
    rightFrontWheel->setName(this->frontRightWheelString.c_str());
    rightBackWheel->setName(this->backRightWheelString.c_str());
    leftBackWheel->setName(this->backLeftWheelString.c_str());
    leftFrontWheel->setName(this->frontLeftWheelString.c_str());
    
    simulator->addColorToColorsDictionary(Color(70.0/256.0,70.0/256.0,70.0/256.0), this->bodyString);
    simulator->addColorToColorsDictionary(Color(0,0,1), this->frontLeftWheelString);
    simulator->addColorToColorsDictionary(Color(1,0,0), this->frontRightWheelString);
    simulator->addColorToColorsDictionary(Color(0,1,0), this->backLeftWheelString);
    simulator->addColorToColorsDictionary(Color(1,1,0), this->backRightWheelString);
    PxRigidBodyExt::setMassAndUpdateInertia(*body, wheelbotBodyMass);
    PxRigidBodyExt::setMassAndUpdateInertia(*leftFrontWheel, wheelbotWheelMass);
    PxRigidBodyExt::setMassAndUpdateInertia(*rightFrontWheel, wheelbotWheelMass);
    PxRigidBodyExt::setMassAndUpdateInertia(*leftBackWheel, wheelbotWheelMass);
    PxRigidBodyExt::setMassAndUpdateInertia(*rightBackWheel, wheelbotWheelMass);
    
    wheelbot->setSeparationTolerance(0.001f);
    
    frontLeftJoint = leftFrontWheel->getInboundJoint();
    frontRightJoint = rightFrontWheel->getInboundJoint();
    backLeftJoint = leftBackWheel->getInboundJoint();
    backRightJoint = rightBackWheel->getInboundJoint();
    
    
    leftFrontWheel->getInboundJoint()->setParentPose(PxTransform(PxVec3(wheelbotHalfWidth,0,-wheelbotHalfHeight),PxQuat(-PxHalfPi,PxVec3(0,1,0))));
    leftFrontWheel->getInboundJoint()->setChildPose(PxTransform(PxVec3(0,0,wheelbotWheelDepth/2.0),PxQuat(-PxHalfPi,PxVec3(0,1,0))));
    
    rightFrontWheel->getInboundJoint()->setParentPose(PxTransform(PxVec3(wheelbotHalfWidth,0,wheelbotHalfHeight),PxQuat(-PxHalfPi,PxVec3(0,1,0))));
    rightFrontWheel->getInboundJoint()->setChildPose(PxTransform(PxVec3(0,0,-wheelbotWheelDepth/2.0),PxQuat(-PxHalfPi,PxVec3(0,1,0))));
    
    leftBackWheel->getInboundJoint()->setParentPose(PxTransform(PxVec3(-wheelbotHalfWidth,0,-wheelbotHalfHeight),PxQuat(-PxHalfPi,PxVec3(0,1,0))));
    leftBackWheel->getInboundJoint()->setChildPose(PxTransform(PxVec3(0,0,wheelbotWheelDepth/2.0),PxQuat(-PxHalfPi,PxVec3(0,1,0))));
    
    rightBackWheel->getInboundJoint()->setParentPose(PxTransform(PxVec3(-wheelbotHalfWidth,0,wheelbotHalfHeight),PxQuat(-PxHalfPi,PxVec3(0,1,0))));
    rightBackWheel->getInboundJoint()->setChildPose(PxTransform(PxVec3(0,0,-wheelbotWheelDepth/2.0),PxQuat(-PxHalfPi,PxVec3(0,1,0))));
    
    
    
    
    
    frontLeftJoint->setSwingLimit(0.001,0.001);
    frontRightJoint->setSwingLimit(0.001,0.001);
    backLeftJoint->setSwingLimit(0.001,0.001);
    backRightJoint->setSwingLimit(0.001,0.001);
    
    
    frontLeftJoint->setSwingLimitEnabled(true);
    frontRightJoint->setSwingLimitEnabled(true);
    backLeftJoint->setSwingLimitEnabled(true);
    backRightJoint->setSwingLimitEnabled(true);
    
    frontLeftJoint->setTwistLimitEnabled(false);
    frontRightJoint->setTwistLimitEnabled(false);
    backLeftJoint->setTwistLimitEnabled(false);
    backRightJoint->setTwistLimitEnabled(false);
    
    //frontLeftJoint->setTargetOrientation(PxQuat(0,PxVec3(1,0,0)));
    //frontRightJoint->setTargetOrientation(PxQuat(0,PxVec3(1,0,0)));
    //backLeftJoint->setTargetOrientation(PxQuat(0,PxVec3(1,0,0)));
    //backRightJoint->setTargetOrientation(PxQuat(0,PxVec3(1,0,0)));
    
    frontLeftJoint->setExternalCompliance(.001);
    frontLeftJoint->setInternalCompliance(.001);
    frontRightJoint->setExternalCompliance(.001);
    frontRightJoint->setInternalCompliance(.001);
    backLeftJoint->setInternalCompliance(.001);
    backLeftJoint->setExternalCompliance(.001);
    backRightJoint->setInternalCompliance(.001);
    backRightJoint->setExternalCompliance(.001);
    
    frontLeftJoint->setSpring(0);
    frontRightJoint->setSpring(0);
    backLeftJoint->setSpring(0);
    backRightJoint->setSpring(0);
    
    frontLeftJoint->setDamping(2000);
    frontRightJoint->setDamping(2000);
    backLeftJoint->setDamping(2000);
    backRightJoint->setDamping(2000);
    
    
    frontLeftJoint->setTargetVelocity(PxVec3(0,0,0));
    frontRightJoint->setTargetVelocity(PxVec3(0,0,0));
    backLeftJoint->setTargetVelocity(PxVec3(0,0,0));
    backRightJoint->setTargetVelocity(PxVec3(0,0,0));
    
    wheelbot->setSolverIterationCounts(255);
    
    simulator->getSimulationScene()->addArticulation(*wheelbot);
    //Set names for rigid bodies (for coloring purposes)
    this->currentState = new rm3d::ai::WheelbotState();
    this->desiredState = new rm3d::ai::WheelbotState();
    this->numDocks = 6;
    this->docks = (rm3d::ai::Dock<PxShape*, PxShape*, PxArticulationLink*, PxFixedJoint*>**)new rm3d::ai::WheelbotDock*[this->numDocks];
    for (int i=0; i<this->numDocks; i++) {
        this->docks[i] = NULL;
    }
    for (int i=0; i<this->numActuatorsSensors; i++) {
        this->sensors[i] = NULL;
        this->actuators[i] = NULL;
        this->percepts[i] = NULL;
        this->actions[i] = NULL;
    }
    
    this->numLinks = 1;
    this->links = new PxArticulationLink*[this->numLinks];
    this->links[0] = body;
    this->numJoints = 0;
    this->joints = NULL;
    this->mBody = wheelbot;
    
    
    this->sensors[posOrientInt] = (rm3d::ai::Sensor *) new rm3d::ai::WheelbotPositionOrientationSensor(posOrientInt);
    this->sensors[linearVelocitiesInt] = (rm3d::ai::Sensor *) new rm3d::ai::WheelbotLinearVelocitiesSensor(linearVelocitiesInt);
    this->sensors[angularVelocitiesInt] = (rm3d::ai::Sensor *) new rm3d::ai::WheelbotAngularVelocitiesSensor(angularVelocitiesInt);
    this->sensors[rangedMessageInt] = (rm3d::ai::Sensor *) new rm3d::ai::WheelbotRangedMessageSensor(rangedMessageInt, sim);
    this->sensors[obstaclePoseInt] = (rm3d::ai::Sensor *) new rm3d::ai::WheelbotObstaclePoseSensor(obstaclePoseInt);
    this->sensors[obstaclePropertiesInt] = (rm3d::ai::Sensor *) new rm3d::ai::WheelbotObstaclePropertiesSensor(obstaclePropertiesInt);
    this->sensors[xAxisRaycastInt] = (rm3d::ai::Sensor *) new rm3d::ai::WheelbotXAxisRaycastSensor(xAxisRaycastInt, 0.3);
    this->sensors[negxAxisRaycastInt] = (rm3d::ai::Sensor *) new rm3d::ai::WheelbotNegXAxisRaycastSensor(negxAxisRaycastInt, 1.0);
    this->sensors[colorBlobInt] = (rm3d::ai::Sensor *) new rm3d::ai::WheelbotColorBlobSensor(colorBlobInt);
    
    
    this->percepts[posOrientInt] = (rm3d::ai::Percept *)new rm3d::ai::WheelbotPositionOrientationPercept(0.0, posOrientInt);
    this->percepts[linearVelocitiesInt] = (rm3d::ai::Percept *) new rm3d::ai::WheelbotLinearVelocityPercept(0.0, linearVelocitiesInt);
    this->percepts[angularVelocitiesInt] = (rm3d::ai::Percept *) new rm3d::ai::WheelbotAngularVelocityPercept(0.0, angularVelocitiesInt);
    this->percepts[rangedMessageInt] = (rm3d::ai::Percept *) new rm3d::ai::WheelbotMessagePercept(0.0, rangedMessageInt);
    this->percepts[obstaclePoseInt] = (rm3d::ai::Percept *) new rm3d::ai::WheelbotObstaclePercept(0.0, obstaclePoseInt);
    this->percepts[obstaclePropertiesInt] = (rm3d::ai::Percept *) new rm3d::ai::WheelbotObstaclePercept(0.0, obstaclePropertiesInt);
    this->percepts[xAxisRaycastInt] = (rm3d::ai::Percept *) new rm3d::ai::WheelbotRaycastPercept(0.0, xAxisRaycastInt);
    this->percepts[negxAxisRaycastInt] = (rm3d::ai::Percept *) new rm3d::ai::WheelbotRaycastPercept(0.0, negxAxisRaycastInt);
    this->percepts[colorBlobInt] = (rm3d::ai::Percept *) new rm3d::ai::WheelbotFramePercept(0.0, colorBlobInt);
    
    
    this->actuators[rangedMessageInt] = (rm3d::ai::Actuator *)new rm3d::ai::WheelbotRangedMessageActuator(rangedMessageInt, sim, 5.0);
    this->actuators[flWheelInt] = (rm3d::ai::Actuator *) new rm3d::ai::WheelbotFrontLeftWheelActuator(flWheelInt);
    this->actuators[frWheelInt] = (rm3d::ai::Actuator *) new rm3d::ai::WheelbotFrontRightWheelActuator(frWheelInt);
    this->actuators[rlWheelInt] = (rm3d::ai::Actuator *) new rm3d::ai::WheelbotBackLeftWheelActuator(rlWheelInt);
    this->actuators[rrWheelInt] = (rm3d::ai::Actuator *) new rm3d::ai::WheelbotBackRightWheelActuator(rrWheelInt);
    
    this->actions[rangedMessageInt] = (rm3d::ai::Action *) new rm3d::ai::WheelbotMessageAction(rangedMessageInt);
    this->actions[flWheelInt] = (rm3d::ai::Action *) new rm3d::ai::WheelbotWheelAction(flWheelInt);
    this->actions[frWheelInt] = (rm3d::ai::Action *) new rm3d::ai::WheelbotWheelAction(frWheelInt);
    this->actions[rlWheelInt] = (rm3d::ai::Action *) new rm3d::ai::WheelbotWheelAction(rlWheelInt);
    this->actions[rrWheelInt] = (rm3d::ai::Action *) new rm3d::ai::WheelbotWheelAction(rrWheelInt);
    
    this->model = (void *)new rm3d::ai::WheelbotModel(10);
}