Orbit MP + servo
Dgephri from United States  [23 posts]
15 year
I see you have an Orbit MP module, and I am interested in slaving a group of servos to mimic the movement a user puts into the Web interface (think user controlled Turret- no live ammo).

As I start setting up the Servo system in the coming weeks I wanted to start learning what method would be most direct for keeping the "turret" tracking where the User inputs to move the viewing area of the Orbit.

I hope to share a really fun project when I get the specifics worked out...thanks for all help.  RR looks to be a great solution to learning VB or C++ myself.  Great application from what I can see to use it for so far.  :)
Anonymous 15 year
I'm not sure I understand your question of "start learning what method would be most direct for keeping the "turret" tracking". Are you hoping to replace the Orbit with a bunch of servos to perform the same movement? Are you hoping to use the servos to mimic the movements of the Orbit at the same time as the Orbit is moving?? Not sure why you'd want to do that. Perhaps if you can give a little background of what you're trying to accomplish this might make it easier for us to understand your question.

Anonymous 15 year
sorry, hit "new post" in error.

I want another set of servos like a turret to track what the orbit cam is pointed towards.

Instead of mounting a fixed camera to a Pan-Tilt mount with a paintball gun on it, I want both the camera and the paintball gun to Pan and Tilt together (with some calibration for range of travel and viewing area) simultaneously with input from the WebServer.

I have already tested the Orbit Webserver and tutorial program, I just want to be able to simultaneously feed that movement into a set of regular servos controlling my paintball gun Pan and Tilt.  Does that help?

From what I see of your amazing software, I can pop up what variable will affect what Servo on the Parallax controller.  With some testing I think I can set range of travel based on that variable to mimic the PTZ of the Orbit?
Dgephri from United States  [23 posts] 15 year
I think I will be able to get this up and running.  Nice to see the fix on the PTZ action, I think I cooked my Orbit MP in a HomeLoop (keep hunting for home until I unplugged it, 3X a charm, no inoperable).

I have my Parallax controller on the way, and replacement Orbit backup coming as well.

Does Roborealm have a Phidget Module?  I would like to tie in a unit like this:
Dgephri from United States  [23 posts] 15 year
trying to integrate my servo movement with the Logitech Orbit Module "move map" and "gui" so it all loads as one RR program.

Still very new to VBscripting so I probably have nested this wrong for the Servos to get the move commands.  I set up the "bystepsvertical" and "bystepshorizontal" so I can adjust the pan/tilt rates of the servo to stay on track with the Orbitcam.

<head><version> by Dgephri</version></head>
commandTimeout = 1
move = GetVariable("move")
if move then  
   if GetVariable("LAST_CHECK") = "0" then
     SetVariable "LAST_CHECK", Timer()
     if Timer() - GetVariable("LAST_CHECK") > commandTimeout then
      SetVariable "move", 0
      SetVariable "LAST_CHECK", 0
    end if
  end if
end if

  home_command = GetVariable("Home_command")
  bystepsvertical = 5
  bystepshorizontal = 5

    else move = 8 then
        Pan_motor = Pan_motor + bystepshorizontal
        if move = 2 then
          Pan_motor = Pan_motor - bystepshorizontal
          if move = 4 then
             Tilt_motor = Tilt_motor - bystepsvertical
            if move = 1 then
               Tilt_motor = Tilt_motor + bystepsvertical
              if move = 16 then
                 Pan_motor = 128
                 Tilt_motor = 128
        end if
      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 "bystepshoriztonal", bystepshorizontal
  SetVariable "bystepsvertical", bystepsvertical


credit to the source of the Orbitcam module, I just want my servos to follow along...
Anonymous 15 year
Seems like a lot of extra stuff was happening in the VBScript routine. I've attached below a reduced version that gets to the essence of what you have above. Also, please note the usage of the .robo upload field to include the roobfile in a post .. makes it much easier to just run instead of copy,paste,save,etc.

Dgephri from United States  [23 posts] 15 year
thanks, I realized that after I had posted and had no Edit option  :)

few of my "haunts" use the upload function, so I don't have a habit of looking for it right off.

Will test the updated code, thanks a ton!
Dgephri from United States  [23 posts] 15 year
odd, when I load the test code you gave me, the servos (Pan and Tilt) respond to the Index.HTML (default using "move=") but the OrbitCam locks in the setting and continually pans right, or seeks Home repeatedly, or pushed down until I reset RR.

The Servos don't stay locked on, they use the "bysteps" increment...

The Orbit GUI doesn't keep it moving: one button press is one movement.

I reattached the program.robo since one of the "case=" variables was mismatched with the Move script and Index.html.
Dgephri from United States  [23 posts] 15 year
sorry, the forum style is still different than I'm used to (not complaining, just adjusting).

I added the TimeOut function from your tutorial to keep the Orbitcam from panning forever.

Nearly there, but it seems to stop moving BOTH the Orbit and the Servos and stick with only one or the other moving.

What am I missing to make sure they are always, both, looking at the "move" variable all the time?

I thought maybe program order was the issue, but moving the VBscript above the Orbit and vice versa don't seem to change the behavior at all.

Pardon my noobishness on this, but I am eager to get is figured out so I can learn the next challenge of tracking w/servo follow up.
Anonymous 15 year
When you "turn off" the logitech move command you also need to neutral the servo commands.

Right after

      SetVariable "move", 0


      SetVariable "Pan_motor", 128
      SetVariable "Tilt_motor", 128

Also you appear to have an error with the GetVariable. The very first line of the script just calls that routine without setting it to move ... so it is unlikely the pan/tilt of the servos is working corrrect. You should only have one

move = GetVariable("move")

at the very start of the file (delete the second one just after the commandTimeout =1 line.


Dgephri from United States  [23 posts] 15 year
on your first note: all that does is set the servos to center after every timeout: they were fine.  Center = 128,128 so anytime the command timeout occurs they move back to "home"

maybe that should be
    setvariable "bystepsvertical",0
    setvariable "bystepshorizontal",0
which will then be set back to "2" at the top of the script next frame?
That would just tell it to stop adding "bysteps" to the Pan/Tilt servos...
EDIT: this changed nothing, anytime Move=0, the Pan/Tilt routine properly gets no information from the Orbit directions.

Your second note fixed the Webcam movement for sure, each cycle it gets a new move command.

However, I still don't have both of them moving?

When I load up the webpage, Pan and Tilt on the Orbit are fine, but as soon as I hit the "Fire" button (I have mapped to input 16-Home) it then sets the Orbit to center, and the servos to center, and only the servos move thereafter...I am stumped.  I can repeat this, and changing order in the .robo file doesn't affect it.

see updated robo file.  I want both the servos and Orbit to move at the same commands.

I am sure this is like a tutorial in scripting, but I am reading and learning other generalized sources as I do this.
Dgephri from United States  [23 posts] 15 year
well, using WatchVariables, I could see the reason my servos didn't work until the "home" command moved them to center 128,128: they were both at 0 +/- so they were beyond numerical extents for the Parallax module to do anything.

My solution (however inelegant) was to insert a startup count on the number of frames so far <50 then Pan/Tilt 128,128.  That way it doesn't keep doing it over and over since the Frame_count variable doesn't get reset normally.

How can I set a variable only ONCE at every startup if it processes the VBscript every frame?

Note that the Logitech still stops working after hitting button triggering "move=16" via the webpage interface, but the servos continue to read their variables.
Anonymous 15 year
In VBScript you'd need a flag to indicate that something has been set. This will prevent the setting of the variable again and again.

If GetVariable("first_time") = "" then
  SetVariable "blabla", value
  SetVariable "first_time", "done"
end if

or you can use the Set_Variable module which has a checkbox to set the variable only once during execution.

Dgephri from United States  [23 posts] 15 year
thx, used the "setvariable" module, made it first the .robo lineup and it works swimmingly.

I think I am going to leave the Orbits alone (not precise enough control) for S3D, and go to a pair of Quickcam9000s.

As always, thanks for the help, still learning!

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