Lynxmotion Tech Support

www.lynxmotion.com
It is currently Sat May 18, 2013 3:58 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun Aug 15, 2010 6:34 pm 
Offline
Robot Guru
User avatar

Joined: Wed Feb 27, 2008 8:59 am
Posts: 3140
Location: Online @ innerbreed.co.uk
Using AtomPro28, BB2, SSC32, with PS2. and running Xans Phoenix code v2.0.

when doing body rotations, tilts and rolls, with the left J/Stick, how can i change the Rotation point using the right stick?

what i mean is 'while doing these movements' instead of just rotating from the center of the body XYZ id like to move the center point of rotation around on the fly using the right J/Stick. :?:

_________________
Jonny Poole,
Freelance Concept Art & Animatronics, 3D Art and 3D Modelling, as well as Physical Modelling, Mechanical design, and illustration.
http://www.innerbreed.co.uk/
Create, Innovate, Inspire.


Top
 Profile  
 
PostPosted: Mon Aug 16, 2010 1:53 am 
Offline
Robot Guru
User avatar

Joined: Thu Nov 09, 2006 5:46 am
Posts: 2077
Location: Norway
Hi Jonny,

Take a look at the BodyIK sub:
Code:
BodyIKLeg var nib
BodyIK [PosX, PosZ, PosY, RotationY, BodyIKLeg]

  ;Calculating totals from center of the body to the feet
  CPR_X = cOffsetX(BodyIKLeg)+PosX
  CPR_Y = PosY + BodyRotOffsetY ; Define centerpoint for rotation along the Y-axis
  CPR_Z = cOffsetZ(BodyIKLeg) + PosZ + BodyRotOffsetZ
 
  ;Successive global rotation matrix:
  ;Math shorts for rotation: Alfa (A) = Xrotate, Beta (B) = Zrotate, Gamma (G) = Yrotate
  ;Sinus Alfa = sinA, cosinus Alfa = cosA. and so on...
 
  ;First calculate sinus and cosinus for each rotation:
   GOSUB GetSinCos [BodyRotX1+TotalXBal1]
  SinG4 = Sin4
  CosG4 = Cos4
 
  GOSUB GetSinCos [BodyRotZ1+TotalZBal1]
  SinB4 = Sin4
  CosB4 = Cos4
 
  GOSUB GetSinCos [BodyRotY1+(RotationY*c1DEC)+TotalYBal1]
  SinA4 = Sin4
  CosA4 = Cos4

  ;Calcualtion of rotation matrix:
 
  BodyIKPosX = (CPR_X*c2DEC - ( CPR_X*c2DEC*CosA4/c4DEC*CosB4/c4DEC - CPR_Z*c2DEC*CosB4/c4DEC*SinA4/c4DEC + CPR_Y*c2DEC*SinB4/c4DEC ))/c2DEC
  BodyIKPosZ = (CPR_Z*c2DEC - ( CPR_X*c2DEC*CosG4/c4DEC*SinA4/c4DEC + CPR_X*c2DEC*CosA4/c4DEC*SinB4/c4DEC*SinG4/c4DEC + CPR_Z*c2DEC*CosA4/c4DEC*CosG4/c4DEC - CPR_Z*c2DEC*SinA4/c4DEC*SinB4/c4DEC*SinG4/c4DEC - CPR_Y*c2DEC*CosB4/c4DEC*SinG4/c4DEC ))/c2DEC
  BodyIKPosY = (CPR_Y  *c2DEC - ( CPR_X*c2DEC*SinA4/c4DEC*SinG4/c4DEC - CPR_X*c2DEC*CosA4/c4DEC*CosG4/c4DEC*SinB4/c4DEC + CPR_Z*c2DEC*CosA4/c4DEC*SinG4/c4DEC + CPR_Z*c2DEC*CosG4/c4DEC*SinA4/c4DEC*SinB4/c4DEC + CPR_Y*c2DEC*CosB4/c4DEC*CosG4/c4DEC ))/c2DEC
 
return


For shifting/changing the CPR you only need to set the variable BodyRotOffsetZ, BodyRotOffsetY. If you need to set the X you'll need to add that variable. It might be a bit hard to change all 3 coordinates at the same time with only one 2DOF joystick though.

_________________
[b]Kåre Halvorsen, Zenta[/b]
-----------------------------------------
Zenta's blog
http://zentasrobots.com/
Zenta's YouTube channel
http://www.youtube.com/ZentaOlbaid
-----------------------------------------


Top
 Profile  
 
PostPosted: Mon Aug 16, 2010 10:11 am 
Offline
Robot Guru
User avatar

Joined: Wed Feb 27, 2008 8:59 am
Posts: 3140
Location: Online @ innerbreed.co.uk
just the person i was looking for. yes silly me why didn't i see that. self explanatory really. :oops:
makes perfect sense.
thanks bud.

_________________
Jonny Poole,
Freelance Concept Art & Animatronics, 3D Art and 3D Modelling, as well as Physical Modelling, Mechanical design, and illustration.
http://www.innerbreed.co.uk/
Create, Innovate, Inspire.


Top
 Profile  
 
PostPosted: Mon Aug 16, 2010 11:20 am 
Offline
Robot Guru
User avatar

Joined: Thu Nov 09, 2006 5:46 am
Posts: 2077
Location: Norway
Your welcome Jonny, good luck with your programming work!

_________________
[b]Kåre Halvorsen, Zenta[/b]
-----------------------------------------
Zenta's blog
http://zentasrobots.com/
Zenta's YouTube channel
http://www.youtube.com/ZentaOlbaid
-----------------------------------------


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group