actuating joints

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

actuating joints

Postby blackbird_dream » Thu Nov 14, 2024 4:55 pm

I'd like to control torques in joints, assuming that each torque is the summation of several torques (lets say an accumulator).
Currently I'm doing :

Code: Select all
ctorque = body1->GetTorque() +torqueval1;
body1->SetTorque(ctorque);
ctorque = body1->GetTorque() +torqueval2; 
body1->SetTorque(ctorque);
etc
ctorque = body2->GetTorque() -torqueval1;
body2->SetTorque(ctorque);
ctorque = body2->GetTorque() -torqueval2; 
body2->SetTorque(ctorque);
etc


where body1 and body2 are respectively parent and child of a given joint.
Is it correc t?
Thks beforehand.
User avatar
blackbird_dream
 
Posts: 379
Joined: Wed Jun 07, 2006 3:08 pm
Location: France

Re: actuating joints

Postby Julio Jerez » Thu Nov 14, 2024 6:36 pm

that should work.
Julio Jerez
Moderator
Moderator
 
Posts: 12425
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: actuating joints

Postby blackbird_dream » Fri Nov 15, 2024 2:53 am

great thks.
I forgot to say, Irrespective of the joint being implemented with a spring damper (SetAsSpringDamper)?
and my code sample was equivalent to :
Code: Select all
ctorque = body1->GetTorque() +torqueval1+torqueval2;
body1->SetTorque(ctorque);
etc
naturally
User avatar
blackbird_dream
 
Posts: 379
Joined: Wed Jun 07, 2006 3:08 pm
Location: France

Re: actuating joints

Postby Julio Jerez » Fri Nov 15, 2024 3:31 am

Yes, it is analogous to gravity.
It act on all bodies, even the one connected by active joints.
Julio Jerez
Moderator
Moderator
 
Posts: 12425
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest