loading
 
Strange behavior of program running on NXT
Michael Kirschner  [6 posts]
16 year
Hey Steven

I'm using RR and a NXT, sending commands and reading sensors over usb.  I have a variable set to 0 unless the bot stops panning then it is set to 1 and that variable is linked to mailbox one, which is toggled to "SEND"

running on the NXT the program waits for a message compares it to the number 1 in mailbox 1 and then preforms motor movements and loops, continuing to check for the recieved message.

the variable changes correctly in RR... but the motor does not move.  SOMETIMES, if I press the stop button in the lego nxt module dialog the motor begins to preform the program running on the NXT as it was supposed to....


any idea what is going on, I can attach my NXT-G program, Robo file, and vb script if that would help?
Anonymous 16 year
here is vbscript, it also seems the motor runs through one loop the first time the program is run and the variable (FIRE) is = to 1, then it never runs through again, even when the variable changes back to 1?


'320x240 resolution camera

' initialize starting servo values
pan = GetVariable("PAN_SERVO")
tilt = GetVariable("TILT_SERVO")
pand = GetVariable("PAN_DEE")
fire = GetVariable("FIRE")
' get the size (width or height) of the current bounding box
size = GetVariable("COG_BOX_SIZE")

' if it is equal to "" then no object was detected
if size <> "" then

' get the horizontal center of gravity
cogX = GetVariable("COG_X")

' pan left




if cogX < 140 then
pan = 36


' pan right
elseif cogX > 180 then
pan = 222


else pan = 128

end if

if Pand > 790 then
pan = 0


elseif pand < -790 then
pan = 255

end if

' get the vertical center of gravity
cogY = GetVariable("COG_Y")

' tilt down

if cogY < 100 then
tilt = 0
' tilt up


elseif cogY > 140 then
tilt = 255

else tilt = 128



end if

if tilt = 128 and pan = 128 then

fire = 1

else  

fire = 0

end if

SetVariable "FIRE", fire
SetVariable "PAN_DEE", pand
SetVariable "PAN_SERVO", pan
SetVariable "TILT_SERVO", tilt

end if
program.robo
Anonymous 16 year
Hello again, I have figured out the problem, even though I do not have MOTOR C under variable control, my program running on the NXT cannot control it for more than a few seconds.  When I disabled the motor control running for the other motors A + B, (I clicked that check box off entirely) the program ran fine on the NXT and the motor C moved as it should.

Is there any way to have the motor operate as it should?
Anonymous 16 year
to clarify, is there a way to have RR control motors a and b and motor c be under NXT control.
Anonymous 16 year
Mike,

We made a change to ensure that the motor values are not sent when no variable is set which should solve your issue. Can you download the latest version and try again?

Thanks,
STeven.
Anonymous 16 year
Hey, I'll be testing this a few days, sorry for the delay, going back to school meant packing up all my servos and stuff.

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