loading
 
VB script power NXT
Max from Netherlands  [8 posts]
2 years
Hello,

We are working on a robot keeper that stops a ball rolling down a hill.
We are using Roborealm with COG and the VB script plugin.
We have created a variable called: DistanceFromCenter which measures as the title explains the amount of pixels the object is removed from the center.
If we move the object that we are tracking the NXT motor will try to follow this object.
When the object is in the middle of the screen (X coordinate 512) the NXT motor is standing still, is the object to the right than the motor will turn to the right so it tries to center it again, if the object is to the left the motor will turn to the left to try to center the object again.
The problem is that between the X coordinates 450 and 590 the NXT does not deliver enough power to move itself and the camera.
How can I make sure that the motor does deliver enough power in the beginning.
This way I can make my programm more precise.
Below you will find a screenshot of our programm.

best regards,

Max


 
Steven Gentner from United States  [1371 posts] 2 years
Max,

I assume the VBscript is setting the robot motor values?

The problem is one of inertia. Meaning there is a power setting below which the NXT will just kind of tense up but not actually move. What you need to do is set the minimum motor value that causes the robot to move and then reduce that value to a desired setting after the robot moves. You can try something like

if movement_is_less_than_some_threshold
  SetVariable "motor", threshold
  SetTimedVariable "motor", actual_value, 200
end if

which will set the motor value to some low setting but high enought to move the robot and then 200 ms later (guessing that this is enough time) set the value lower once the robot starts moving. This pulses the motor values such that they should be enough to start moving. You'll have to experiment with the minimum power value and pulse time as this will depend on the surface the robot is on. Hard surfaces will require less power to get moving.

Note, it is also advisable that you have a dead zone 500 to 524 (or maybe a wider pixel range) as within that range the robot just cannot move that precisely and it will start to oscillate with the solution mentioned above.

STeven.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index