loading
 
avm
CJ from Australia  [21 posts]
6 years
hi there its cj i just wanted to ask i am trying to use avm with my nxt and i currently have got my robots head on a tunable base however i make it learn an object and i make motor a variable equal turret balance but it continuesoly turns left it wont stop or turn right or anything do i need a vb script if so could you please point me in the right direction as i have never used these could you please make one for me if necessary so i can study it thanks in advances
program.robo
EDV  [328 posts] 6 years
You should use servo for camera turning and use variable NV_TURRET_BALANCE in this case. But if you use just simple motor instead servo then you could use variables NV_TURRET_LEFT and NV_TURRET_RIGHT and you would use VBScript program like this:

nv_L_Motor = GetVariable("NV_L_MOTOR")
nv_R_Motor = GetVariable("NV_R_MOTOR")
nv_Turret_Left = GetVariable("NV_TURRET_LEFT")
nv_Turret_Right = GetVariable("NV_TURRET_RIGHT")


nxt_L_Motor = round(128 + (nv_L_Motor/100.0)*127)
nxt_R_Motor = round(128 + (nv_R_Motor/100.0)*127)

nxt_Turret_Motor = 128

if nv_Turret_Left <> 0 then nxt_Turret_Motor = 64
if nv_Turret_Right <> 0 then nxt_Turret_Motor = 192


SetVariable "NXT_L_MOTOR", nxt_L_Motor
SetVariable "NXT_R_MOTOR", nxt_R_Motor
SetVariable "NXT_TURRET_MOTOR", nxt_Turret_Motor

For more detail see attached program file below:
program.robo
CJ from Australia  [21 posts] 6 years
Thanks so much I finally got it working just had to make a few number changes as the head is moved by a worm gear thanks again :)
EDV  [328 posts] 6 years
But servo would be better solution for camera turning because it participates in initial localization of "Marker mode" and "Navigation by map" modes for camera getting of state "look forwards".
CJ from Australia  [21 posts] 6 years
But it's a nxt motor and under servos I don't see nxt so I have to use the method above right?
EDV  [328 posts] 6 years
In dialog window of RoboRealm "Lego NXT" module there is "Servos" page. So, if you have lot of servos amounting to your NXT then it would be better to use it with camera turning.

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