Asked — Edited

New Possibe Plugin/Feature Request. Clicksteer?

I had briefly touched on this in one of my other threads.... Anyway, I thought of a good idea (well, I think so anyway) for a plugin or new feature for the camera control... Click steer.... So what it would do is if you have a pan and tilt setup with the ezb4 camera you would be able to click on an area of the camera image the x and y servo would move to centre in on the area you clicked.... For example you click on the top left corner of your camera's image, the x and y servo would attempt to centre the camera on the top left corner of the image...

Also, you can use the same principal to steer the robot while it is moving forward... Click left on the camera image and the robot will steer proportionally to the left depending how far left in the image you clicked... And of course same for the right... So steering the robot using your mouse and camera image...

I could probably hack something up using the plugin Remote mouse... However that would mean I could never move the camera control or it would throw everything off...


ARC Pro

Upgrade to ARC Pro

Don't limit your robot's potential – subscribe to ARC Pro and transform it into a dynamic, intelligent machine.

PRO
Synthiam
#1  

That's a good idea - but don't use the remote mouse. You would use any of the overlay plugins. On the panel which displays the image is an event called "OnMouseClick". You simply need to grab the coordinates of the mouse click and perform the appropiate command (move servo or steer). Of course steering can only be done using the HBridge with PWM. And because every robot is different, you would require many values to adjust/tweak for the turning speeed which is relative to the robot speed. Every robot will have a different speed. Also, same applies with clicking on the window to move servos for focus. This would require some math to calculate the number of degrees based on the servo lever.

Wouldn't be too hard:) Give it a shot!

#2  

Ok.... I will see what I can come up with.... Cheers :)

#4  

Ok, so to be clear... I need to download your example camera overlay and tweak the Visual Studio example to extract the "OnMouseClick" x and y coordinates? Ha, ha... I'll give it a shot. I'll load your example into visual studio and poke around and see if my seriously limited (actually pretty much none existent) C# abilities can do this.... Assuming I can alter the plugin to accomplish this, would I need to publish it as a new plugin?

PRO
Synthiam
#5  

Correct :)

You would need to publish it as a new plugin if you wish to share it with others. Either way, it requires a unique guid, etc..

#6  

Crap my 30 day trial version of VS has expired so I can't load the project....... Did I hear you mention there was a free version somewhere?

#7  

Free version is called Community Edition

https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx

Thia is very similar to something I want to achieve, although more autonomous. I want to recognize an object. By a combination of pan/tilt and robot poaition adjustments drive towards it, adjusting the camera as I get closer so it is always centered in view. When the camera position indicates I have reached the object, execute an AutoPosition action to have an arm pick up the object.

I have been struggling with how to script this, and now think a plugin may be the way to go.

Alan

#8  

Hey @Alan... I guess I need to remove my 30day trial version first before I install the one you linked to?

#10  

@thetechguru,

Quote:

Thia is very similar to something I want to achieve, although more autonomous. I want to recognize an object. By a combination of pan/tilt and robot poaition adjustments drive towards it, adjusting the camera as I get closer so it is always centered in view. When the camera position indicates I have reached the object, execute an AutoPosition action to have an arm pick up the object.
I do the first part of this with the camera controls. I have my InMoov robot look for an object, I use a red ball, by panning left and right. Once the object is centered , the robot moves toward the object and it keeps it centered, it stops moving when it can no longer see it. It would be easy then to have it reach out and take on object handed to it. I haven't tried to get it to pick up the object off of a table but it think it is doable. I can do it with my robotic arm. It will search for, say a red object, once it finds and centers it in the camera, it reaches out and picks it up.

#11  

Bob, is your project posted so I can look at what it is doing?

Alan

#12  

Here it is,



Sayezb("OK")

sleep(1000)
ControlCommand("Script Manager", ScriptStart, "Anti collision")


:step 2
ControlCommand("Camera", CameraServoTrackEnable)
ControlCommand("Camera", CameraColorTrackingEnable, "red")

#center camera on object
if($Cameraistracking = 1)
sleep(500)

GoTo(step 5)

Else
ServoDown(D1,10)
servospeed(D1,6)
sleep(700)
endif
$x=Getservo(D1)
if($x < 90)
goto(step 3)
#endif
sleep(1000)
else
goto(step 2)
endif

:step 3
ControlCommand("Camera", CameraServoTrackEnable)
ControlCommand("Camera", CameraColorTrackingEnable, "red")

if($Cameraistracking = 1)
sleep(500)

GoTo(step 5)
else
ControlCommand("Camera", CameraServoTrackDisable)

ServoUp(D1,10)
servospeed(D1,6)
sleep(700)
endif

$x=Getservo(D1)
if($x>134)

goto(step 2)
sleep(1000)
else
GoTo(step 3)
endif


:step 5
Waitfor($cameraverticalquadrant = "middle" and $camerahorizontalquadrant = "middle",1000)
Sleep(300)

Servo(d1,124)
sleep(300)
ControlCommand("Camera", CameraMovementTrackEnable)
ControlCommand("Camera", CameraServoTrackDisable)
ControlCommand("Auto Position", AutoPositionFrame, "Travelling", 25,3,3)

if($CameraisTracking = 0)
goto(step 2)

endif

#13  

Thanks Bob,

That will get me started.

#14  

My pleasure, always happy to share. If we go any further with this, I think we should start another thread. Although some of what you are trying to do is related to Richard's original question, I think we are close to hijacking this thread.

#15  

No worries guys... I get ideas from what you post and talk about here too....

#16  

Funny enough I have something very similar to what Bob posted... It's an auto docking routine for one of my rovers that uses colour tracking, a ping and an IR sensor (like the one I suggested to @Bob for his inMoov's) to locate and dock to recharge.... I wrote it as a small part of my quest to achieve autonomous navigation with EZ Robot. It's a long way from being finished but I might just make a video and post my docking routine...

#17  

So here is a quick video of my docking routine that I mentioned above.... It uses similar colour tracking as @Bobs example... One tricky part was to get the robot to drive backwards while tracking and while looking in a mirror;) Yes, there is a small mirror in which the ezb4 camera is looking in while driving backwards... and tracking to boot... Yes, this is slightly cheating as this robot was part of a kit meant for a mini itx pc (linux) and ROS... However, I wanted to see if I could mimic the Oculus ROS docking sequence using an ezb4 and ARC. Turns out my docking script works better than the Oculus one... It docks successfully 9 times out of 10... I still have the "big one" to tackle and of course that is autonomous navigation part...

below is my code to do what is shown in the video


if ($IsCameraActive != 1)
  ControlCommand("Camera", CameraStart)
endif
ControlCommand("Script Manager", ScriptStop, "Volt Monitor")
$R_motor_F = 87
$L_motor_F = 168
$R_motor_RV = 45 # extra slow for docking
$L_motor_RV = 210 # extra slow for docking
$R_motor_R = 40
$L_motor_R = 168
$R_motor_L = 87
$L_motor_L = 215
sleep(1000)
servo(D1,90) #turn light on
$light = 1
ControlCommand("Camera", CameraColorTrackingEnable)
sleep(500)
repeatuntil($CameraIsTracking = 1)
  right() #rotate looking for docking target....
  sleep(250)
endrepeatuntil
stop()

ping_Wait(D2,D2,Lower,70) #Stop when within 70cm of dock
ControlCommand("Camera", CameraColorTrackingDisable)
stop()
$V_delay=getvoltage()
if ($V_delay < 11.1) #depending on battery charge in order to rotate 180 degrees
  $rotate_delay = 2150
ELSEif ($V_delay < 12)
  $rotate_delay = 1950
ELSE
  $rotate_delay = 1800
endif
sleep(1000)
if (getservo(D0) != 170 and $autodock = 0)
  SendSerial(D23,38400,20) #rotate to face dock backwards
  SendSerial(D23,38400,146)
  sleep($rotate_delay)
  SendSerial(D23,38400,0)
endif
servo(D0,170) #rotate camera to face backwards looking in the mirror

sleep(1000)
:re_dock
ControlCommand("Camera", CameraColorTrackingEnable)
$autodock = 1

adc_Wait(adc0,lower,50) #stop 10cm from target
sleep(100)
ControlCommand("Camera", CameraColorTrackingDisable)
stop()

sleep(2000)
if (getvoltage()>14)
  servo(D0,80) #camera facing forward
  servo(D1,180) #light off
  sayezb("docking successful")
  saywait("docking successful")
  print("docking successful")
  sleep(500)
  ControlCommand("Script Manager", ScriptStart, "Flash strobe")
  $autodock = 0
  $R_motor_RV = 40
  $L_motor_RV = 215
ELSE #docking unsuccessful attempt re-dock
  forward()
  sleeprandom(2000,3000)
  # ControlCommand("Camera", CameraColorTrackingEnable)
  sleep(1500)
  if ($CameraObjectCenterX > 167) #turn to line up target again
    right()
  ELSE
    left()
  endif
  sleep(300)
  stop()
  goto(re_dock)
endif
ControlCommand("Script Manager", ScriptStart, "Volt Monitor")

PRO
Synthiam
#18  

Try this - and make sure you have the latest ARC: https://synthiam.com/redirect/legacy?table=plugin&id=58

I didn't test it yet - because i don't have any robots at my house, believe it or not! Isn't that weird? The source code is published in the plugin if you want to see how i did it. It's pretty quick and simple.

#19  

@DJ Thanks... I'll have to try it out tomorrow afternoon. I have a very early morning ... Again thank you... :).... I know, I know.... I really should get my a** in gear and learn how to do some plugins....

PRO
USA
#20  

@Richard:

Nice touch: Docking successful !

What kind of kit is that, is the docking included too ?

Charging circuit, did you built any electronic to manage the charging process ?

Cheers

#21  

You can find the kit here... Oculus ROV .... If you get the basic kit, it is an awesome bot to use with an ezb4 and the LIPO charging control board comes with the basic kit to boot... :)

PRO
Synthiam
#22  

So, anyone going to take my plugin source code and make it steer? :)

I'll give you a hint. There's a class called EZ_Builder.EZBManager.Ezbs[0].Movement

And in there is a .Forward() and .Right() etc....

That's how you make the robot execute its direction of the added movement panel.

#23  

@DJ I can do the basic logic coding if, else etc, no problem... It's knowing what I am doing within Visual Studio and learning C# syntax that's the hard part....

#24  

@Rich

Your get the hang of it. Most are based around C so some commands are easy to grasp. It's the switching between languages for long periods at a time that can get you confused for a bit. Heck even commenting can have a different syntex, -- // /* */.