CHAI3DCHAI3D

normal can't get ODE-BALL off the ground

More
26 Apr 2017 04:31 #1

I'm new to ODE module and I'm trying my first demo following the example 06-ODE-exploration-demo2. I placed five balls and five cylinders with my own textures in the scene.

Now the force feedback is OK but dynamics is not working as I expected. I can't pick any ball off the ground as if they were set to move only on the surface of it.

Could anyone help me with it? Any suggestion would be appreciated.


tool setup
handler->getDevice(hapticDevice0, 0);
		maxStiffness = cMin(maxStiffness, 0.5*hapticDevice0->getSpecifications().m_maxLinearStiffness);
		tool0 = new cToolGripper(world);
		
		world->addChild(tool0);
		tool0->setHapticDevice(hapticDevice0);
		tool0->setRadius(toolRadius);
		tool0->setLocalPos(cVector3d(0.01, 0, 0.01));
		tool0->enableDynamicObjects(true);
		tool0->setWaitForSmallForce(true);
		tool0->setWorkspaceRadius(1.0);
		tool0->start();
		tool0->setWaitForSmallForce(true);
		tools[0] = tool0;
		cMesh* mesh_thumb = mesh->copy();
		tool0->m_hapticPointThumb->m_sphereProxy->addChild(mesh_thumb);
		tool0->m_hapticPointThumb->setShow(true, false);
		cMesh* mesh_finger = mesh->copy();
		tool0->m_hapticPointFinger->m_sphereProxy->addChild(mesh_finger);
		tool0->m_hapticPointFinger->setShow(true, false);

balls setup
for (int i = 0; i < MAX_ODE_BALLS_NUM;i++)
	{
		balls[i] = new cMesh();
		cCreateSphere(balls[i], BALL_RADIUS);
		balls[i]->createAABBCollisionDetector(toolRadius);
		matBall.setRedIndian();
		matBall.m_specular.set(0, 0, 0);
		matBall.setStiffness(0.1*maxStiffness);
		matBall.setDynamicFriction(0.9);
		matBall.setStaticFriction(0.9);
		balls[i]->setMaterial(matBall);
		balls[i]->m_texture = cTexture2d::create();
		fileload = balls[i]->m_texture->loadFromFile("..\\resources\\images\\spheremap-3.jpg");
		if (!fileload) cout << "Error - ball texture failed to load." << endl;
		balls[i]->m_texture->setSphericalMappingEnabled(true);
		balls[i]->setUseTexture(true);
		balls[i]->m_material->setBlueRoyal();

		ode_balls[i] = new cODEGenericBody(ODEWorld);
		ode_balls[i]->setImageModel(balls[i]);
		ode_balls[i]->createDynamicSphere(BALL_RADIUS,false);
		ode_balls[i]->setMass(0.02);
	}
        //reset ball location
	for (int i = 0; i < MAX_ODE_BALLS_NUM; i++)
	{
		ode_balls[i]->setLocalPos(cVector3d(0.05, -0.04 + i*(BALL_RADIUS + 0.01), 0.025));
	}

Please Log in or Create an account to join the conversation.

More
28 Apr 2017 15:43 #2

I am not really sure about the issue but...

can you try

matBall.setStiffness(maxStiffness);

or

set gravity to 0 and see if you are able to lift them .

Please Log in or Create an account to join the conversation.

More
02 May 2017 05:08 #3

@BhanuKiran


I kinda "fixed" it yesterday. Still don't know exactly why, though.

I deleted this single line of code:

tool0->setWorkspaceRadius(1.0);
When I ran my program, distance between two HapticPointer proxies were set to 0, then I was able to lift the balls.

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum