roborealm set-up - trouble shooting

Hexapod Robots

Re: roborealm set-up - trouble shooting

Postby plingboot » Thu Jul 14, 2011 9:53 am

Thanks for the teraterm hint - looking in that file also enabled me to change the default start-up to my preferred settings.

With config and locomotion directed through the ESD200, i still need to open teraterm, type PIP CONTROL and quit, before i can wake the hexapod in roborealm.

Cobbled together a working example of object detection/tracking/following with AVM Navigator, which no body can be more surprised about than me. ;)

It's Matt's blob tracking vbs script - I assumed that if i found the correct variables to swap it should, in theory, work.

So…
i'm using
NV_ARR_OBJ_RECT_W in place of COG_BOX_SIZE
and
cogX = GetVariable("COG_X")
cogY = GetVariable("COG_Y")
become
cogX = GetVariable("NV_ARR_OBJ_RECT_X")
cogY = GetVariable("NV_ARR_OBJ_RECT_Y")

NV_ARR_OBJ_RECT_W is width of recognised object
NV_ARR_OBJ_RECT_X and NV_ARR_OBJ_RECT_Y are the top left co-ordinates of the object.

This is quick and dirty to see if it would work some (simple?) maths could be used to find the centre of the recognised object instead - which would probably yeild better results when it's running.

The hexapod will track a known object now, but it's a bit slow and it also hunts a bit. I tried changing the sensitivity variables, but the oscillation issue mucks it up.

Following isn't so good, it easily looses the object as it walks.
I think sorting the maths so it's actually tracking the centre of the object rather than the top left corner will definitely help.

Video later…
Sheriff of Nothing
plingboot
 
Posts: 281
Joined: Sun Jun 01, 2008 5:30 pm
Location: the gutter, fashionable south west london

Re: roborealm set-up - trouble shooting

Postby TemplarGFX » Thu Jul 14, 2011 10:19 am

use this to get the centre :

cogX = int(GetVariable("NV_ARR_OBJ_RECT_X") + (GetVariable("NV_ARR_OBJ_RECT_W") / 2))
cogY = int(GetVariable("NV_ARR_OBJ_RECT_Y") + (GetVariable("NV_ARR_OBJ_RECT_H") / 2))

also I would suggest setting this

' Deadband for BALL Center.
cDeadBand = 20

this greatly reduces the chance the head will continually swing back on forth, but "lowers" accuracy
Hexapod Pet Project
Vision Based Object Avoidance with Roborealm
TemplarGFX
 
Posts: 76
Joined: Thu Mar 17, 2011 10:32 am

Re: roborealm set-up - trouble shooting

Postby plingboot » Thu Jul 14, 2011 11:58 am

Great, thanks for that.
Panning is working ok, but tilt seems to be locked.

On wake, the hexapod looks up and to it's left (my right).
I show it a recognised object and i can get it to follow it horizontally, but as i bring it down (in the roborealm window), it doesn't pan down to keep it central.
Sheriff of Nothing
plingboot
 
Posts: 281
Joined: Sun Jun 01, 2008 5:30 pm
Location: the gutter, fashionable south west london

Re: roborealm set-up - trouble shooting

Postby TemplarGFX » Thu Jul 14, 2011 12:04 pm

what are your PT+ PT- config settings?
Hexapod Pet Project
Vision Based Object Avoidance with Roborealm
TemplarGFX
 
Posts: 76
Joined: Thu Mar 17, 2011 10:32 am

Re: roborealm set-up - trouble shooting

Postby Matt Denton » Thu Jul 14, 2011 2:41 pm

plingboot wrote:With config and locomotion directed through the ESD200, i still need to open teraterm, type PIP CONTROL and quit, before i can wake the hexapod in roborealm.


Ok, then if you can access config and control through one port then I guess you have a different jumper setting, in which case this is correct behaviour. You just need to send out the "PIP CONTROL" string at the beginning of the VB script.
Matt Denton
AKA: Winchy_Matt

micromagic systems ltd
Matt Denton
Site Admin
 
Posts: 1622
Joined: Tue May 20, 2008 9:15 pm
Location: Winchester UK

Re: roborealm set-up - trouble shooting

Postby plingboot » Thu Jul 14, 2011 3:31 pm

hmm… there's a glitch somewhere in the script relating to tilt, but i can't seem to identify it yet.
Pan is working pretty well but tilt is defaulting to looking as far up as the servo will go.

files here if anyone want to have a look: vbs and robo

As a total aside i'm using a turnigy 11.1v, 1600mAh pack with a turnigy switching reg and the difference in up time between it and a 4000mAh NiMh stick is huge.
Sheriff of Nothing
plingboot
 
Posts: 281
Joined: Sun Jun 01, 2008 5:30 pm
Location: the gutter, fashionable south west london

Re: roborealm set-up - trouble shooting

Postby TemplarGFX » Fri Jul 15, 2011 3:48 am

can you give me a rundown of what happens? Looking at the code there should be no issue. I remember I had problems with getting my hexapod to look down, but mainyl due to the fact that it physically could not look down (the bottom spacer bar was tapping against the servo body)
Hexapod Pet Project
Vision Based Object Avoidance with Roborealm
TemplarGFX
 
Posts: 76
Joined: Thu Mar 17, 2011 10:32 am

Re: roborealm set-up - trouble shooting

Postby EDV » Thu Mar 29, 2012 8:11 am

I think that there is complete solution of object tracking and it could be helpful for your task.

I tested it on the prototype of “Twinky rover” and it works fine:

Object tracking


Twinky rover presentation


I also added “Learn from motion” option to “Object recognition” mode and you should download RoboRealm package
with new AVM Navigator v0.7.4.

>> Hi, how do I update AVM Navigator? I purchased it last version.

You had to receive download link after registration on RoboRealm site.
Just use this link for downloading recent version of RoboRealm package with AVM Navigator.

You could also start RoboRealm application and then click "Option" button and further click "Download Upgrade".

Further you should set "Learn from motion" checkbox with "Object recognition" mode in AVM Navigator dialog window.

plingboot wrote:I've had a 'fiddle' with AVM navigator and managed to teach it a few objects/faces, but not the first idea how to turn that into tracking commands…

It is easy. You should just use "Object recognition mode" in AVM Navigator module.
First clear the AVM search tree by click on button "Set key image size(New)" and further press "Yes".

Now you can train AVM on some faces like in video below:

Face training demo


When training will be done you should use variables that described below for your VBScript program:

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

As example you can use these VBScript programs that was published in this topics:
http://www.roborealm.com/forum/index.php?thread_id=3881#
http://forums.trossenrobotics.com/showthread.php?4764-Using-of-AVM-plugin-in-RoboRealm&p=48865#post48865
EDV
 
Posts: 8
Joined: Tue Sep 28, 2010 8:10 am

Re: roborealm set-up - trouble shooting

Postby EDV » Mon Apr 23, 2012 9:50 am

It is a testing of the enhanced tracking algorithm that takes into consideration variable servo speed:

Object tracking with variable servo speed


See VBScript program and diagram below for more details:

Code: Select all
' Get turret control variables
flt_base = 10000

rate_v  = GetVariable("RATE_V")/flt_base
turret_v  = GetVariable("TURRET_V")/flt_base
turret_Sv = GetVariable("TURRET_V_SPEED")

rate_h  = GetVariable("RATE_H")/flt_base
turret_h  = GetVariable("TURRET_H")/flt_base
turret_Sh = GetVariable("TURRET_H_SPEED")
turret_f  = GetVariable("TURRET_FIRE")
step_counter = GetVariable("STEP_COUNTER")

dX = 0
dY = 0

status = ""
turret_v_initial = -80

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
   
   dXr = 1 - abs(dX*4/img_w)
   if dXr < 0 then dXr = 0
   
   dYr = 1 - abs(dY*4/img_h)
   if dYr < 0 then dYr = 0
   
   turret_min = -100
   turret_max = 100
   reaction   = 7
   speed_min  = 1
   speed_max  = 100
   filtering  = 0.7
   decay      = 0.1
   threshold  = round(img_w*0.03)

   sRateH = exp(-dXr*reaction)
   sRateV = exp(-dYr*reaction)
   
   rate_h = rate_h + (sRateH - rate_h)*filtering
   rate_v = rate_v + (sRateV - rate_v)*filtering
   
   turret_Sh = round(speed_min + rate_h*(speed_max - speed_min))
   turret_Sv = round(speed_min + rate_v*(speed_max - speed_min))
   
   delta_h = (img_w/8)*rate_h
   delta_v = (img_h/8)*rate_v

  if step_counter =< 0 then
      step_counter = round(exp(-(dXr*dYr)*reaction*0.7)*15)
      
      if dX > threshold then
         ' The object is at left side
         turret_h = turret_h - delta_h
      
         if turret_h < turret_min then turret_h = turret_min
      end if

      if dX < -threshold then
         ' The object is at right side
         turret_h = turret_h + delta_h
      
         if turret_h > turret_max then turret_h = turret_max
      end if
   
      if dY > threshold then
         ' The object is at the bottom
         turret_v = turret_v - delta_v
      
         if turret_v < turret_min then turret_v = turret_min
      end if
   
      if dY < -threshold then
         ' The object is at the top
         turret_v = turret_v + delta_v
      
         if turret_v > turret_max then turret_v = turret_max
      end if
   else
      step_counter = step_counter - 1
   end if
      
   ' Is the target locked?
   if dX < threshold and dX > -threshold and dY < threshold and dY > -threshold then
      status = "Target is locked"
      turret_f = 1
   else
      status = "Tracking"
      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 > turret_v_initial then turret_v = turret_v - 1
   if turret_v < turret_v_initial then turret_v = turret_v + 1
   
   turret_Sh = speed_min
   turret_Sv = speed_min
   
   rate_h = rate_h - rate_h*decay
   rate_v = rate_v - rate_v*decay
   
   turret_f = 0
end if

' Set turret control variables
SetVariable "RATE_V", rate_v*flt_base
SetVariable "TURRET_V", turret_v*flt_base
SetVariable "TURRET_V_CONTROL", round(turret_v)
SetVariable "TURRET_V_SPEED", turret_Sv
SetVariable "RATE_H", rate_h*flt_base
SetVariable "TURRET_H", turret_h*flt_base
SetVariable "TURRET_H_CONTROL", round(turret_h)
SetVariable "TURRET_H_SPEED", turret_Sh
SetVariable "TURRET_FIRE", turret_f
SetVariable "STEP_COUNTER", step_counter
SetVariable "DELTA_X", dX
SetVariable "DELTA_Y", dY
SetVariable "TURRET_STATUS", status

Image
EDV
 
Posts: 8
Joined: Tue Sep 28, 2010 8:10 am

Previous

Return to Hexapods

Who is online

Users browsing this forum: No registered users and 4 guests

cron