loading
 
Can I merge AVM with external control
Scott Portocarrero from United States  [12 posts]
6 years
Hey I was just wondering if it was possible to merge my existing RR program with AVM.  I want be able to control my bot with my Playstation remote (which already works) and still have AVM do its thing.  Attached is my file please take a look an let me know if it can be done.
program.robo
Scott Portocarrero from United States  [12 posts] 6 years
I assume I would use the AVM - NV_L_MOTOR & NV_R_MOTOR variables in some way?
EDV  [328 posts] 6 years
I think for merging of manual and automatic control by Navigator is needed changes in your VBScript program like this:


' this program translates the joystick range of -1000 and 1000 to 0 and 255. This number
' can then be feed directly to the robot for speed and turing

' amount of y joystick determines speed
speed = 128 - CInt(((GetVariable("joy_y") * 128) / 1000))
' amount of x joystick determines rotation
turn = CInt(((GetVariable("joy_x") * 128) / 1000))

' determine intermediate values
manual_left = speed + turn
manual_right = speed - turn

'ensure they are within the range 0 - 255
if manual_left<0 then manual_left=0
if manual_right<0 then manual_right=0
if manual_left>255 then manual_left=255
if manual_right>255 then manual_right=255

nv_L_Motor = GetVariable("NV_L_MOTOR")
nv_R_Motor = GetVariable("NV_R_MOTOR")

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

manual_control = GetVariable("MANUAL_CONTROL")

if manual_left <> 128 OR manual_right <> 128 then manual_control = 100

if manual_control = 0 then mleft = nxt_L_Motor else mleft = manual_left
if manual_control = 0 then mright = nxt_R_Motor else mright = manual_right

if manual_control > 0 then manual_control = manual_control - 1

' finally set the variables to be used in the joystick module
SetVariable "left_motor", mleft
SetVariable "right_motor", mright
SetVariable "MANUAL_CONTROL", manual_control


If manual control is activated then it set the value of MANUAL_CONTROL variable to 100.  Control will be switched to manual in this case and will stay in this status during about 4 seconds after stop of manual commands (while MANUAL_CONTROL will countdown).

For more detail see attached program file below:
program.robo
EDV  [328 posts] 6 years
Sorry, I forgot to include AVM Navigator module to the top of the video pipeline in my program.robo file. It is necessary for producing of NV_L_MOTOR and NV_R_MOTOR variables. So you should include it yourself :)

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