Page 1 of 2

Autonomous RC Tank controlled by a NXT brick

Posted: 15 Aug 2011, 13:47
by robotrandi



Hi guys,

I'm quite new on this forum and I wanted to share with you one of my latest projects:
http://trandi.wordpress.com/2011/05/14/ ... %80%93-v3/

The above post contains all the details, including the code (for the Arduino slave board too !) but in a nutsell, it's about an airsoft RC tank that I hacked so that it can be FULLY controlled by a NXT brick (programmed in LeJOS) and fully AUTONOMOUS.
I've also added an IR Camera hacked from a WiiMote, which allows it to track and lock on targets (a simple IR LED) and then fire plastic pellets at it...


I'd be very keen to have some feedback from you guys and / or any suggestions for improvement... !

Thanks,
Dan

P.S. There's a link at the beginning of the post to the previous post which has plenty of pictures with the actual NXT brick inside the tank: http://trandi.wordpress.com/2011/05/02/ ... c-tank-v2/

Re: Autonomous RC Tank controlled by a NXT brick

Posted: 15 Aug 2011, 16:04
by HaWe
very nice, but:
...controlled by a NXT brick?
where and how?

Re: Autonomous RC Tank controlled by a NXT brick

Posted: 15 Aug 2011, 17:08
by robotrandi
Sorry, there are no pictures in that post of the internal of the tank.
There's a link at the beginning of the post, to the previous post which has plenty of them:
http://trandi.wordpress.com/2011/05/02/ ... c-tank-v2/

Also the Java code you see in the main post IS the code running on the Lego NXT, using LeJOS.

Dan

Re: Autonomous RC Tank controlled by a NXT brick

Posted: 15 Aug 2011, 17:26
by HaWe
thx for the new movie but I'm still not clear about what the NXT is actually doing and in which respect this tank is autonomous...?

Re: Autonomous RC Tank controlled by a NXT brick

Posted: 15 Aug 2011, 19:14
by robotrandi
The link that I've posted in my 1st reply doesn't just show a new movie, but it has plenty of details / pictures about the internals:
- how the NXT brick is connected to the Arduino board (that controls the tracks motors)
- how one NXT motor is moving the turret
- etc. ...

The NXT brick is running all the high level algorithms, in a multi-threaded manner 1 thread controlling the turret and another independent one for the chassis. Which means that the 2 are independent.

Now for the AUTONOMOUS part, as you can see in the videos (or in the code if you care reading it) the tank wonders by itself and looks for a target. Once it finds it, it "locks" on it and then tries to approach it. Once it's at around 80cm it stops and fires at it !

Hope this answers your questions,
dan

P.S. you do see a remote control in some of the videos, this is because there are 2 modes for the tank :
- a manual one, where it simply responds to your commands, as any other RC toy
- an AUTONOMOUS one, where it does what I've just mentionned with absolutely no external intervention

Re: Autonomous RC Tank controlled by a NXT brick

Posted: 15 Aug 2011, 19:19
by mightor
I love the mix of NXT and home brew! Nice job :)

- Xander

Re: Autonomous RC Tank controlled by a NXT brick

Posted: 15 Aug 2011, 19:39
by hergipotter
VERY cool!!

One question, why is it waiting so long after it has found a target before it is shooting? A technical reason?

Re: Autonomous RC Tank controlled by a NXT brick

Posted: 15 Aug 2011, 19:46
by robotrandi
Mightor : yes, if I don't solder a few wires / pins in a project I don't feel like "owning" it ! :)

Hergipotter : exactly, it's a technical reason. It is supposed to wait a little bit, but only 2 seconds not 20-30 as in the video... I'm not sure what's happening there but I think it's a concurrency issue between the "firing thread" and the turret control one... and as everybody know, multithreading issues are hard to find / debug.

dan

Re: Autonomous RC Tank controlled by a NXT brick

Posted: 15 Aug 2011, 20:54
by HaWe
how is the tank detecting a target?

Re: Autonomous RC Tank controlled by a NXT brick

Posted: 16 Aug 2011, 00:20
by nxtreme
doc-helmut wrote:how is the tank detecting a target?
!!!
robotrandi wrote:I've also added an IR Camera hacked from a WiiMote, which allows it to track and lock on targets (a simple IR LED) and then fire plastic pellets at it...
I vote that we put up a PayPal fund called the "Get Doc a new pair of glasses fund" :).

Seriously now, that is very cool! I had the same idea a while back, using a WiiMote camera to track IR light sources but I never got my hands on a WiiMote, which made it a bit hard to hack it :). Keep it up!