nagyistoce / tin-man

Automatically exported from code.google.com/p/tin-man
GNU General Public License v3.0
0 stars 0 forks source link

MoveToWithGain question #30

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
hi,

i use MoveToWithGain  function to move joints i newwd to know in this call for 
example 
:
myAgent.Body.HJ2.MoveToWithGain(myAgent.Body.HJ2.LimitAngle(Angle.FromDegrees(90
)), 1);

what is the speed of the joint.

and how about this call:

myAgent.Body.HJ2.MoveToWithGain(myAgent.Body.HJ2.LimitAngle(Angle.FromDegrees(90
)), 10);

and how can i calculate this in RPM.

thanks in advance.

Original issue reported on code.google.com by mef...@gmail.com on 3 Dec 2011 at 5:13

GoogleCodeExporter commented 9 years ago
Hi @mefmef,

The speed produced by MoveToWithGain depends upon the difference between the 
current angle and the target angle.

If you need to specify a specific speed, you can set it directly upon the Hinge:

    myAgent.Body.HJ2.DesiredSpeed = AngularSpeed.FromDegreesPerSecond(10);

However, perhaps you are trying to find out what speed the control function 
(MoveToWithGain) will choose in the current cycle.  Is that so?

Original comment by drewnoakes on 3 Dec 2011 at 7:57

GoogleCodeExporter commented 9 years ago
:) 
if i use :
myAgent.Body.HJ2.DesiredSpeed = AngularSpeed.FromDegreesPerSecond(10);

it would not stop on the exact degree so this is not usable for me.

i want to use that control function and i need to know the average speed to 
reach that degree .

so yes i would like to know the speed chosen to reach that angle.

Original comment by mef...@gmail.com on 3 Dec 2011 at 8:27

GoogleCodeExporter commented 9 years ago
in another words:
what is the co relation between average speed chosen by  MoveToWithGain 
function and angle difference and gain i sent to that function (speed in rpm)?

Original comment by mef...@gmail.com on 3 Dec 2011 at 8:31

GoogleCodeExporter commented 9 years ago
If you are using MoveToWithGain then you don't need to specify any speeds.  
That is done automatically.

The math behind MoveToWithGain is pretty straightforward [1]:

  speed = (currentAngle - targetAngle) * gain;

So the larger the difference in angle, the faster the speed.  The same is true 
for gain.

Currently the TinMan cycle calculates the target speed *after* the call to 
'Think', meaning that you cannot read the speed that will be generated.  I 
would like to add the ability to see the *actual* speed obtained in the last 
simulation cycle, though that may not actually be the speed you requested (due 
to physical simulation.)

I hope that helps.  If not, perhaps you could explain more about why you need 
this speed information :)

[1] 
http://www.google.com/codesearch#HByDNgWaRAM/trunk/TinMan/HingeControlFunctions.
cs&q=MoveToWithGain%20package:http://tin-man%5C.googlecode%5C.com&l=55

Original comment by drewnoakes on 3 Dec 2011 at 10:57

GoogleCodeExporter commented 9 years ago
One further point on MoveToWithGain -- if you use a very large gain, the 
movement will be unstable and will oscillate wildly, failing to settle on the 
target angle.  You may have to experiment with gain values to find the right 
kind of tradeoff.

If you really need advanced control over hinges, you might like to read about 
the PidController class too, though that adds some extra complexity and 
additional variables to understand/choose.

Original comment by drewnoakes on 3 Dec 2011 at 11:02

GoogleCodeExporter commented 9 years ago
I'm closing this issue.  Feel free to post again if you have further questions. 
 Perhaps I should set up a mailing list...

Original comment by drewnoakes on 5 Dec 2011 at 7:26