USB Servo controlling, working with VBscript in RoboRealm
new to Servos, new to VBscript, new to Roborealm.
Working on a Pan-Tilt routine to follow a Webcam field of view.
So far, I have adapted the RR Center of Gravity script to get a +10/-10 response out of my servos
Buttons activate left (+10) right (-10) up (+10) and down (-10).· In the control module I can set "clear on release" which then allows it to snap back to 128, 128.· As long as I hold the control module button down, it continues to climb or decrease, but I would rather have stepwise fuction one click + second click + third click, etc.
I am having a block figuring out how to set it to accumulate the change: button once =+10, second adds up to +20 etc.
Edit 11:00am PST with revisions
"· pan_left = GetVariable("Pan_left")
· pan_right = GetVariable("Pan_right")
· tilt_up = GetVariable("Tilt_up")
· tilt_down = GetVariable("Tilt_down")
· home_command = GetVariable("Home_command")
· bysteps = 2
··· if Pan_right < 0 then
······· Pan_motor = Pan_motor + Pan_right
····· else
······· if Pan_left > 0 then
········· Pan_motor = Pan_motor + Pan_left
······· else
········· if Tilt_up > 0 then
············ Tilt_motor = Tilt_motor + Tilt_up
········· else
··········· if Tilt_down < 0 then
·············· Tilt_motor = Tilt_motor + Tilt_down
··········· else
············· Pan_motor = 128
············· Tilt_motor = 128
····· end if
··· end if
· end if
end if
· SetVariable "Pan_motor", Pan_motor
· SetVariable "Tilt_motor", Tilt_motor
· SetVariable "Pan_left", Pan_left
· SetVariable "Pan_right", Pan_right
· SetVariable "Tilt_up", Tilt_up
· SetVariable "Tilt_down", Tilt_down
· SetVariable "Home_command", Home_command
· SetVariable "bysteps", bysteps"
I also want to set the "home_command" variable to reset to 128,128 or center.
All help appreciated, maybe the wrong section of the forum, but this is the only section I found threads about the USB Servo controller.
Post Edited (Dgephri) : 3/5/2008 7:03:23 PM GMT
Working on a Pan-Tilt routine to follow a Webcam field of view.
So far, I have adapted the RR Center of Gravity script to get a +10/-10 response out of my servos
Buttons activate left (+10) right (-10) up (+10) and down (-10).· In the control module I can set "clear on release" which then allows it to snap back to 128, 128.· As long as I hold the control module button down, it continues to climb or decrease, but I would rather have stepwise fuction one click + second click + third click, etc.
I am having a block figuring out how to set it to accumulate the change: button once =+10, second adds up to +20 etc.
Edit 11:00am PST with revisions
"· pan_left = GetVariable("Pan_left")
· pan_right = GetVariable("Pan_right")
· tilt_up = GetVariable("Tilt_up")
· tilt_down = GetVariable("Tilt_down")
· home_command = GetVariable("Home_command")
· bysteps = 2
··· if Pan_right < 0 then
······· Pan_motor = Pan_motor + Pan_right
····· else
······· if Pan_left > 0 then
········· Pan_motor = Pan_motor + Pan_left
······· else
········· if Tilt_up > 0 then
············ Tilt_motor = Tilt_motor + Tilt_up
········· else
··········· if Tilt_down < 0 then
·············· Tilt_motor = Tilt_motor + Tilt_down
··········· else
············· Pan_motor = 128
············· Tilt_motor = 128
····· end if
··· end if
· end if
end if
· SetVariable "Pan_motor", Pan_motor
· SetVariable "Tilt_motor", Tilt_motor
· SetVariable "Pan_left", Pan_left
· SetVariable "Pan_right", Pan_right
· SetVariable "Tilt_up", Tilt_up
· SetVariable "Tilt_down", Tilt_down
· SetVariable "Home_command", Home_command
· SetVariable "bysteps", bysteps"
I also want to set the "home_command" variable to reset to 128,128 or center.
All help appreciated, maybe the wrong section of the forum, but this is the only section I found threads about the USB Servo controller.
Post Edited (Dgephri) : 3/5/2008 7:03:23 PM GMT