elfege
USA
Asked
— Edited
Resolved by DJ Sures!
Hi everybody,
I'm stuck with GLyph, QRcode, object tracking and all camera features because :
When I write a script such as :
If($CameraQRcode = "DOCK")
Print("I CAN SEE THE QR CODE")
Endif
It seems to work in a totally random way. Once, by chance, the QR code has been seen, IT WILL ALLWAYS BE SEEN, even when the camear is totally looking elsewhere. The script still prints out the message. I tried to find a funcion which would reset the QRcode and found the controlcommand("camera", CameraResetQRCode) in the online script manual (this control doesn't appear at all in the Script Help nor in the Cheat Sheet), but still the same result.
Can someone help me with this?
Here (one of) the script(s) I'm trying to get running :
ControlCommand("Camera", PauseOff)
ControlCommand("Script Manager", scriptstart, "avoidIRSEUL")
ControlCommand("Camera", CameraQRcodeTrackingEnable)
pwm(D19, 99)
:start
repeatuntil($CameraQRcode = "DOCK")
left(250, 300)
sleep(2000)
EndRepeatUntil
ControlCommand("Camera", CameraResetQRCode)
sleep(2000)
if($CameraQRcode = "FORWARD")
Goto(closer)
else
RepeatUntil($CameraQRcode = "FORWARD")
left(250, 500)
sleep(2000)
EndRepeatUntil
Goto(closer)
Endif
:closer
ControlCommand("Script Manager", ScriptStart, "dock")
Halt()
I know I'm missing something(s)... but I'm stuck... and frustrated...
Well, well, well, as it often happens, just having felt incentived to ask my question online made me find the answer... had to use the variable $cameraistracking... and some other details.
HOWEVER now I need to know how I can make my robot move in such a manner that it will turn left/right move sligtly forward/reverse until the QRcode is centered in the camera's window and thus aligned with the robot.
When I find this out, since I already have a docking script that works pretty well as long as the robot is more or less aligned with the docking station, I'll have finished doing an almost complete automating docking system!
Who will help me with this, show me the way?
Thanks in advance! Elfège.
QR recognition is very slow and is not designed for movement tracking. There is a little blurb about it in the Camera Device manual page.
Where is this script running? Is it a Script Manager? Or is it On Tracking Start in the camera device? Because if it's just a script, then you don't actually check if the camera has detected it or not with the status. It's recommended to use the Tracking Start script in the Camera Device. Reference the tutorial for Multi Color Tracking in the Activity section. Here is a direct link: https://synthiam.com/Tutorials/Lesson/64?courseId=6
In the future, you can use the [ code ] and [ /code ] UBB code commands to wrap your code examples to make it easier for others to read. You can see UBB code examples on this page while replying or creating posts. I have edited your post to make it easier for me to read.
The ResetQRCode ControlCommand() is indeed in the Cheat Sheet. All commands are in alphabetical order, you will find it in the Cheat Sheet list under the Camera Device.
Thank you DJ and yes, indeed the QRcoderest function is in the cheat sheet. That's what happens when you spend too many hours on one thing, you lose focus and miss so many things. blush
I got everything working and my robot can dock by itself now, and even recover from missing the station.
Thanks again.
Elfege
Elfege, could you share more details (maybe even your project file and a video of it working)? There are numerous threads about the theoretical possibility of auto-docking with EZ-B, but I think you are the first who has done a practical implementation. I am sure I am not alone un being curious how you achieved both the locating and connecting power of the dock.
Alan
I'll send a video and my file the day I can get QRcodes to work... at all. For now, the camera tracking recognizes the QRcodes (it shows tens of lines in the debug) but the corresponding script will not kick in.
Dj, I can't just use the "Tracking start" feature because it would work whatever the QR code or Glyph or Object is detected. It kicks in as soon as ANYTHING is detected and I want to be able to configure differentiated behaviors. It is getting really annoying and I don't know what I am missing here. Glyph scripts all kick in properly.
Thetechguru, I already have a "smartdock" script that works as long as the rover is more or less aligned. It can even try again if no success after several short left/right and long pushes (forwards at low pwm but long time such as 3000 ms) to make contact. I also use an old neato base for it is very convenient due to its width and springs that push the connectors back toward the rover.
I'm sending a copy of my EWbuilder file. Maybe you can tell me why my QRcode scripts won't kick in.
Best,
Elfège
Ok I have finished the bigger part of the auto-docking process. There's still some work to do but it is, so far, efficient enough. I'll just need to bring the robot not too far from the glyph.
Here is a video with the ARC file. Some scripts are useless in the scrip manager and I still have to dump them. The important ones are those :
Boot off AvoidIRseul Search (the one that starts the search for the glyph) Armrest keepalive GotoGlyph1
ROBOTS.EZB
very cool. thanks for posting the project and video.
Alan
Little update - docking with error handling
youtu.be/kQaZuT-XeyA
ROBOTS.EZB