Rotation joint?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Rotation joint?

Postby Ustary » Thu Sep 23, 2010 6:54 pm

Hi, i'm creating a kind of robot using the Truevision built in Newton. For this robot i have 3 "kinda wheels" set in a triangle formation. all these "wheels" have been attached to the main body using hinge joints, and it works ok, the wheels rotate freely. the thing is, in my robot these 3 wheels as to be all connected with gears, in way so that in order for one to rotate, the other 2 must rotate also. Like they were all attached to the same axis, except this axis isn't "linear"(since it is a triangle formation).

Said in another way, i could also say that i want all of the wheels to always have the same rotation.

Can anyone help me set this up please? i have no idea how to do this...

PS: i wrote "wheels" when in fact these are round legs, which only move in a rotation around one axis...

thanks in advance
Ustary
 
Posts: 2
Joined: Thu Sep 23, 2010 6:46 pm

Re: Rotation joint?

Postby ledahut » Fri Sep 24, 2010 3:01 am

i want all of the wheels to always have the same rotation.

If you want gear king joint, use
NewtonConstraintCreateUserJoint and in NewtonUserBilateralCallBack you need to set the correct jacobian for NewtonUserJointAddGeneralRow.

Or you can try with CustomJoint from jointLibrary (But I don't know how to create gear from these joints at the moment).

Question: Is you robot can turn? or just move forward and back?.
ledahut
 
Posts: 98
Joined: Mon Jun 21, 2010 8:03 am
Location: France

Re: Rotation joint?

Postby Ustary » Fri Sep 24, 2010 8:53 am

The robot will be able to turn, since it actually has 2 sets of 3 legs, which move separetly.

Can you pls right an example? i don't really know much of newton, and even though i believe this should be fairly simple, as it is so common in a physics multibody, i can't really figure it out...
Ustary
 
Posts: 2
Joined: Thu Sep 23, 2010 6:46 pm

Re: Rotation joint?

Postby ledahut » Fri Sep 24, 2010 10:20 am

I use pascal object from delphi:
I just have a little exemple of gear joint:
When cube1 is in rotation, cube2 translate and vice versa. [Use arrow left and right] [the apps crash when closing because I haven't free every instance].
http://le.dahut.free.fr/gear.exe

Gear exemple:
I assume the world has already 2 cube and theirs body created with properly callback [setTransform and SetForceAndTorque].

In form.create
Code: Select all

  pivotpoint := GLCube1.AbsolutePosition;
  FNewtonJoint := NewtonConstraintCreateHinge(FNewtonWorld, @pivotpoint,
    @pindir, PNewtonBody(GLCube1.TagObject),
    PNewtonBody(GLCube3.TagObject));

  pindir := VectorMake(0, 0, 1, 0);
  pivotpoint := GLCube2.AbsolutePosition;
  FNewtonJoint := NewtonConstraintCreateSlider(FNewtonWorld, @pivotpoint,
    @pindir, PNewtonBody(GLCube2.TagObject), PNewtonBody(GLCube3.TagObject));

  FNewtonJoint := NewtonConstraintCreateUserJoint(FNewtonWorld, 6,
    @NewtonUserBilateralCallBack, 0, PNewtonBody(GLCube2.TagObject),
    PNewtonBody(GLCube1.TagObject));


In implementation
Code: Select all
procedure NewtonUserBilateralCallBack(const userJoint: PNewtonJoint;
  timestep: Float; threadIndex: Integer); cdecl;
var
  jac1, jac2: array [0 .. 5] of single;
begin
  jac1[0] := 0;
  jac1[1] := 0;
  jac1[2] := 1; //Z translation
  jac1[3] := 0;
  jac1[4] := 0;
  jac1[5] := 0;

  jac2[0] := 0;
  jac2[1] := 0;
  jac2[2] := 0;
  jac2[3] := 0;
  jac2[4] := 1; //Y rotation
  jac2[5] := 0;

  NewtonUserJointAddGeneralRow(userJoint, @jac1, @jac2);
end;


I don't really know how jacobian work [I just use them one time in school before] and I made this demo five month ago.

But by setting correctly these arrays, you can make your wheel2 turn if wheel1 is turning [with differents factors, depends of values].
ledahut
 
Posts: 98
Joined: Mon Jun 21, 2010 8:03 am
Location: France


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 138 guests