📜 ⬆️ ⬇️

Easy spy tank programming


I want to tell you how you can manage iGadgets from a PC, and even program them. Everything described in the article applies to both Brookstone Rover Spy Tank and AR Drone Parrot. On “Habré” there were already articles about a series of high-tech AR Drone Parrot gadgets. Brokstone Rover Spy Tank is somehow of little interest, although, oddly enough, this toy, although not as spectacular, due to the fact that it does not fly, is more practical. Firstly, the charge of 6 elements of the AA series is sufficient for several hours of continuous work. Secondly, it can be used as a geek webcam, with which you can monitor what is happening at home from any other computer, and, as a bonus, drive your pets. By setting up RDP access to your home computer, you can control this product as a mobile webcam, which not only shows the picture, but also moves around the room.


Let's start with what Brookstone Rover Spy Tank



Brookstone Rover Wireless Spy Tank is a wireless controlled tank. The iPhone or iPad acts as a control panel. Communication takes place directly through a Wi-Fi point created. The device is equipped with a built-in video camera, with which you can monitor others. Also on the device is a microphone and an infrared emitter, for shooting in complete darkness. It feeds a miracle tank of six AA batteries. For owners of devices on Android, there is a RoverOpen implementation and is available for download on the GooglePlay Market at play.google.com/store/apps/details?id=org.almende.roveropen

Recently, the second version of the tanks appeared on the market. They added a couple of improvements. A servo drive has been added, with which the angle of rotation of the camcorder is controlled from the application and the speaker through which you can play sounds. In addition to all of the above, the built-in lights were added to the all-terrain vehicle, whose brightness can also be controlled remotely through the application. For this version of the tank there are official applications in the App Store and on Google Play.
')


Manage from PC


If you do not have an iPhone or an android device, then you are unlikely to acquire such a gadget. But if you really want? What then?

There is such a great software package - EZ-Builder, a tool of a Canadian friend. It already has an exchange protocol with AR Drone Parrot and Brookstone Rover Spy Tank. The program is written in C #. Management is easier than a steam turnip. Download software from here

www.ez-robot.com/EZ-Builder

Installation is simple and does not require a description.


Easy programming on EZ-Script


EZ-Builder has the ability to write simple scripts in common scripting language. He is a bit like a BASIC. EZ-Builder allows you to program the behavior of a toy without being a professional robot builder and software engineer. In the EZ-Script language, you can write simple programs with which you can control our rover. In order to master them and understand the principle, we add a management console to the EZ-Builder desktop: “Script Console”. To do this, just press F3 or select it in the Add Control -> Scripting -> Script Console item.

Let us examine several commands:


You can always get help on all teams on special tabs or by calling the appropriate help through:

Help -> Print Script Manual

Learn to follow objects.


In the Tracking Types section, we tick the Color punch. We place a bright object in front of the camera of our device (the best of all is red). Switch to the Color tab, select the minimum object size (Min Object Size) and set the object brightness (Object Brightness). As soon as the item is identified, our tank will begin to turn in his direction if we try to move it. I would advise in the settings in the Tracking Quadrant Settings section to move the vertical lines a little closer to the edge so that the robot reacts more adequately to the movement of the object. Further, playing with different parameters, you will be able to independently achieve the necessary settings and optimal values.


Simple program



Now, aggregating the received information, we connect everything together. Add the Script Manager component to the EZ-Builder desktop: Ad Control -> Scripting -> EZ-Script Manager. In the window that opens, click the Add Script button. In the Name field we write: PursuitTarget. This will be the name of our program responsible for the movement. It will be very simple and consist of one line. In general, it must be said that in EZ-Builder all components are interconnected by the names of windows and script names. We write the program as follows:

forward(255)

We only need this in order to set the forward speed to the maximum, since we will reduce it in the target search program. Press Add Script again, in the Name field we write: FindTarget and, accordingly, the program text itself:

 $findTargetSpeed = 100 $iteration = 0 :Loop1 reverse($findTargetSpeed,1000) #   left($findTargetSpeed, 2000) right($findTargetSpeed, 4000) left($findTargetSpeed, 2000) $iteration = $iteration + 1 if ($iteration > 4) return() goto(Loop1) stop() 

Now click the Config button on the Camera panel, go to the Scripts tab and in the Tracking Scripts section in the Tracking Start field we write the call to our PursuitTarget script:

ControlCommand( "Script Manager", ScriptStart, "PursuitTarget" )

and in the field Tracking End we enter:

ControlCommand( "Script Manager", ScriptStart, "FindTarget" )

Go to the Tracking Settings tab in the Movement Tracking section and tick the appropriate box. Also tick off the inscription Allow Left / Right Movement. We save. Click Refresh Device List, select Video Device: Brookstone_Rover, put a tick on Debug and on Color. Go to the Color tab and set the size and brightness of the pursued object. Now it is enough to throw a red ball in front of the “nose” of our terminator, as he immediately recognizes it and activates. After which he will begin his pursuit. As soon as the robot will bump into it, the ball will most likely be rolled to the side. The robot will turn in his strontium, and if he loses sight of him at all, he will begin to move back, turning from side to side and trying to find the intended goal.

Programming AR Drone Parrot


It is no different. Only engine start and landing commands are added.


What's next?


In the next article, there is a desire to describe an example of working on C #, while fastening a laser flashlight and converting it into a laser rangefinder with a webcam.


PS: Thanks to icases.ru for the kindly provided gadgets for testing

Source: https://habr.com/ru/post/161529/


All Articles