loading
 
Missile Launcher Tracking
from United States  [16 posts]
6 years
Is it possible to have the missile launcher track an object, and when centered on the object fire a shot?

Ben
from United States  [16 posts] 6 years
Or to be more exact, the missile launcher wouldn't be doing the moving, but the robot would have a missile launcher on it. So the robot would track an object, and when centered the missile launcher would fire.

Thanks1
EDV  [328 posts] 6 years
I think you could use AVM Navigator with VBScript program like this:

' Get turret control variables
turret_v = GetVariable("TURRET_V_CONTROL")
turret_h = GetVariable("TURRET_H_CONTROL")
turret_f = GetVariable("TURRET_FIRE")


nvObjectsTotal = GetVariable("NV_OBJECTS_TOTAL")

if nvObjectsTotal>0 then   ' If any object was found
    ' Get image size
    img_w = GetVariable("IMAGE_WIDTH")
    img_h = GetVariable("IMAGE_HEIGHT")
    
    ' Get array variables of recognized objects
    nvArrObjRectX = GetArrayVariable("NV_ARR_OBJ_RECT_X")
    nvArrObjRectY = GetArrayVariable("NV_ARR_OBJ_RECT_Y")
  nvArrObjRectW = GetArrayVariable("NV_ARR_OBJ_RECT_W")
  nvArrObjRectH = GetArrayVariable("NV_ARR_OBJ_RECT_H")

    ' Get center coordinates of first object from array
    obj_x = nvArrObjRectX(0) + nvArrObjRectW(0)/2
    obj_y = nvArrObjRectY(0) - nvArrObjRectH(0)/2
    
    ' Get difference between object and screen centers
    dX = img_w/2 - obj_x
    dY = img_h/2 - obj_y
    
    threshold = 40
    
    if dX > threshold and turret_h > -128 then
        ' The object is at left side
        turret_h = turret_h - 1
    end if

    if dX < -threshold and turret_h < 127 then
        ' The object is at right side
        turret_h = turret_h + 1
    end if
    
    if dY > threshold and turret_v > -128 then
        ' The object is at the bottom
        turret_v = turret_v - 1
    end if
    
    if dY < -threshold and turret_v < 127 then
        ' The object is at the top
        turret_v = turret_v + 1
    end if

    ' Is the target locked?
    if dX < threshold and dX > -threshold and dY < threshold and dY > -threshold then
        turret_f = 1
    else
        turret_f = 0
    end if
else
    ' Back to the center if object is lost
    if turret_h > 0 then turret_h = turret_h - 1
    if turret_h < 0 then turret_h = turret_h + 1
    if turret_v > 0 then turret_v = turret_v - 1
    if turret_v < 0 then turret_v = turret_v + 1
    
    turret_f = 0
end if

turret_v128 = turret_v + 128
turret_h128 = turret_h + 128

' Set turret control variables
SetVariable "TURRET_V_CONTROL", turret_v
SetVariable "TURRET_H_CONTROL", turret_h
SetVariable "TURRET_FIRE", turret_f

SetVariable "TURRET_V_128", turret_v128
SetVariable "TURRET_H_128", turret_h128

=============================
TURRET_H_128 - horizontal turret control
TURRET_V_128 - vertical turret control
TURRET_FIRE - fire signal

See attached program below.
program.robo
from United States  [16 posts] 6 years
I never learned VB Script, but I think I semi understand it. To help out a newbie, where does the motor control come in?

Thanks!!!

Ben
EDV  [328 posts] 6 years
The source data for turret control is deviation of the object center from center of screen  (variables dX, dY). Further it influence on status of intermediate control variables "turret_h" and "turret_v" that has range from -128 to 127.

    if dX > threshold and turret_h > -128 then
        ' The object is at left side
        turret_h = turret_h - 1
    end if

    if dX < -threshold and turret_h < 127 then
        ' The object is at right side
        turret_h = turret_h + 1
    end if
    
    if dY > threshold and turret_v > -128 then
        ' The object is at the bottom
        turret_v = turret_v - 1
    end if
    
    if dY < -threshold and turret_v < 127 then
        ' The object is at the top
        turret_v = turret_v + 1
    end if

The variable "threshold" is working like hysteresis that prevents self-oscillation of turret.

    if dX < threshold and dX > -threshold and
       dY < threshold and dY > -threshold then
        turret_f = 1
    else
        turret_f = 0
    end if

When object is found in center of screen then it activate fire signal (variable turret_f ).
from United States  [16 posts] 6 years
To use that VBscript you wrote for real, what would need to be modified?
EDV  [328 posts] 6 years
I think that this VBScript program is complete and it not needs in any changes. You can use variables TURRET_V_CONTROL and TURRET_H_CONTROL (range from -128 to 127 ) or variables TURRET_H_128 and TURRET_V_128 (range from 0 to 255 with 128 being neutral) for servos pan-tilt control. Also you can use Scale_Variable module for scaling into any convenient range:
http://www.roborealm.com/help/Scale_Variable.php

And you can use serial module for transmitting of variables value to your robot/turret:
http://www.roborealm.com/help/Serial.php

or any other module like these:
http://www.roborealm.com/help/Lego_NXT.php
http://www.roborealm.com/help/Endurance_Servo.php
from United States  [16 posts] 6 years
Whats the range for AVM Navigator?
EDV  [328 posts] 6 years
The AVM Navigator is an additional module that is distributed along with RoboRealm:
http://www.roborealm.com/help/AVM_Navigator.php

And VBScript program use variables NV_OBJECTS_TOTAL, NV_ARR_OBJ_RECT_X, NV_ARR_OBJ_RECT_Y, NV_ARR_OBJ_RECT_W, NV_ARR_OBJ_RECT_H that was produced by AVM Navigator as the source data for object pointing:

NV_OBJECTS_TOTAL  - total number of recognized objects
NV_ARR_OBJ_RECT_X - left-top corner X coordinate of recognized object
NV_ARR_OBJ_RECT_Y - left-top corner Y coordinate of recognized object
NV_ARR_OBJ_RECT_W - width of recognized object
NV_ARR_OBJ_RECT_H - height of recognized object
from United States  [16 posts] 6 years
Ok so for scale variable, my motor does not have a range. (It is the motor used in electronic scooters/wheel chairs. So how do I use that?
EDV  [328 posts] 6 years
However let's try another variant of VBScript program:

' Set the turret control variables
turret_h = 0
turret_v = 0
turret_f = 0

nvObjectsTotal = GetVariable("NV_OBJECTS_TOTAL")

if nvObjectsTotal>0 then   ' If any object was found
    ' Get image size
    img_w = GetVariable("IMAGE_WIDTH")
    img_h = GetVariable("IMAGE_HEIGHT")
    
    ' Get array variables of recognized objects
    nvArrObjRectX = GetArrayVariable("NV_ARR_OBJ_RECT_X")
    nvArrObjRectY = GetArrayVariable("NV_ARR_OBJ_RECT_Y")
    nvArrObjRectW = GetArrayVariable("NV_ARR_OBJ_RECT_W")
    nvArrObjRectH = GetArrayVariable("NV_ARR_OBJ_RECT_H")

    ' Get center coordinates of first object from array
    obj_x = nvArrObjRectX(0) + nvArrObjRectW(0)/2
    obj_y = nvArrObjRectY(0) - nvArrObjRectH(0)/2
    
    ' Get difference between object and screen centers
    dX = img_w/2 - obj_x
    dY = img_h/2 - obj_y
    
    threshold = 40
    
    if dX > threshold then
        ' The object is at left side
        turret_h = - 1
    end if

    if dX < -threshold then
        ' The object is at right side
        turret_h = 1
    end if
    
    if dY > threshold then
        ' The object is at the bottom
        turret_v = - 1
    end if
    
    if dY < -threshold then
        ' The object is at the top
        turret_v = 1
    end if

    ' Is the target locked?
    if dX < threshold and dX > -threshold and
       dY < threshold and dY > -threshold then
        turret_f = 1
    end if
end if

' Set turret control variables
SetVariable "TURRET_V_CONTROL", turret_v
SetVariable "TURRET_H_CONTROL", turret_h
SetVariable "TURRET_FIRE", turret_f

=================================
TURRET_H_CONTROL - horizontal turret control
                                    (0 - motor off, 1 - right turn, -1 - left turn)

TURRET_V_CONTROL - vertical turret control
                                    (0 - motor off, 1 - turn it upward, -1 - turn it downward)

TURRET_FIRE - fire signal

See attached program below.
program.robo
from United States  [16 posts] 6 years
I'll load it up and try it. Which reminds me, where exactly do I load VBscript?

Also, Is is possible to have a camera that is mounted on a robot to do the "looking" (pan/tilt) but have the robot drive towards it?
EDV  [328 posts] 6 years
>> I'll load it up and try it. Which reminds me, where exactly do I load VBscript?

First you should download The Microsoft® Windows® Script Control:
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=1949

See VBScript module guide for more details:
http://www.roborealm.com/help/VBScript_Program.php

Further download the VBScript program:
http://www.roborealm.com/forum/program.php?post_id=23034

Start RoboRealm and load "program.robo" file (click "Open" button in main dialog window).
from United States  [16 posts] 6 years
Thanks, I'll play around with it. So AVM Navigator is loaded when you load the vbscript right?

HAve you ever tried mapping with a kinect?
EDV  [328 posts] 6 years
>> Thanks, I'll play around with it. So AVM Navigator is loaded when you load the vbscript right?

Yes, of course the AVM Navigator will be placed to video-processing pipeline when you will load "program.robo" file.

>> Have you ever tried mapping with a kinect?

The main idea of AVM Navigator project is the using only visual images from one video camera as input sensory information for robot navigation (it does not stipulate for using of any other sensors like kinect, laser, infrared or acoustic detectors and etc).
from United States  [16 posts] 6 years
So does AVM navigator "warn" itself before bumping into anything?
EDV  [328 posts] 6 years
You can use emulator program (based on Quake 3 mod) for acquaintance with "Marker mode" and "Navigation by map" modes.

See "AVM Quake 3 mod" manual for more details:
http://www.roborealm.com/help/AVM_Navigator/avm_q3mod_help.html

You can download it from:
http://www.roborealm.com/help/AVM_Navigator/Setup_avm_q3mod.exe

How "Navigation by Map" works.

Obstacle avoidance

The robot processes the motion history of input images for the previous second. If any commands were given (i.e. the "forward" command) but no changes where seen in the input image (nothing happened) then the robot is assumed to be stuck (i.e. the robot is pushing against a wall). When stuck the module will set the movement variables to move backwards. The stuck situation is indicated by a red rectangle with a circle in the center.

Odometry / localization

The robot sets the marks (it writes central part of the screen image with associated data to AVM tree). Marker data (inside AVM) contain horizon angle (azimuth), path length from start and X, Y location position (relative to the start position). Information for the marker data is based on marks tracking (horizontal shift for azimuth and change of mark scaling for path length measurement). Generalization of all recognized data of marks in input image gives actual value of azimuth and path length. If we have information about motion direction and value of path length from previous position and x, y coordinates of previous position then we can calculate the next coordinates of the current position. This information will be written to the new mark (inside AVM) when it is created and so forth.

The set of marks inside the AVM gives a map of locations (robot see the marks and recognize its location).
from United States  [16 posts] 6 years
Is their anyway to map out entire rooms? (Or houses?) So you could click to go to this corner of a room etc. So instead of paths, rooms?
EDV  [328 posts] 6 years
You just set up visual marks that will be associated with map location coordinates in "Marker mode" (but it not create any path to somewhere) and then robot in "Navigation by map" mode will plan the path from the current location to the target position (maze solving) that you point to.

Thus if you could show every inch of your rooms to robot (in "Marker mode") then it would allow to move robot to any random position in your house:
http://www.youtube.com/watch?v=5qKQg5e4wbc

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