Society of Robots - Robot Forum

Software => Software => Topic started by: Dino_Martino on October 03, 2010, 03:09:51 AM

Title: Software to send PC joystick values to robot using BT (LEGO MINDSTORMS NXT)
Post by: Dino_Martino on October 03, 2010, 03:09:51 AM
Hi all!
I'm new to the forum, and it looks like a great one!
Please forgive my poor English, I'm not a native speaker.
I've got a question, and I've been searching for an answer a long time.

I have built a MINDSTORMS NXT robot (tank).
I want to remote control it  (Bluetooth) using my PC joystick.

Joystick: logitech freedom 2.4 Ghz. Connected to my PC using USB.

I want to do all the programming on the NXT side (NXT-G or NXC). I do NOT want to code my computer (like C).

What I am looking for is a PC program/utility that does nothing more than sending joystick values (axis values and button presses) to the NXT via bluetooth (serial COM-port).
I am NOT looking for direct control => I want to program my NXT to respond to the joystick changes the way I want.

I've searched for a long time, and haven't found anything.
I don't understand why it is so hard to find.


All I need is a PC utility that reads joystick values, and sends these values to a BT device over a COM-port.
(that does not recquire any PC-side programming).

Does anyone know something like this?

Thank you all very much!

~~ Martijn Hellemans
Title: Re: Software to send PC joystick values to robot using BT (LEGO MINDSTORMS NXT)
Post by: rbtying on October 03, 2010, 01:59:20 PM
Someone else coded one (python): http://principialabs.com/joystick-control-of-a-servo/ (http://principialabs.com/joystick-control-of-a-servo/).  On another note, it's probably easier to program it PC side than on the NXT... your computer has at least 100x the processing power and 10000x the memory. 
Title: Re: Software to send PC joystick values to robot using BT (LEGO MINDSTORMS NXT)
Post by: macdad- on October 03, 2010, 02:34:35 PM
A good multipurpose/multiplatform utility that I use is RoboRealm which works with Lego Mindstorms(Both RCX and NXT), you can get a free 30-day trial on it.
http://www.roborealm.com/index.php (http://www.roborealm.com/index.php)

But you could also try NQC(I use it too), it has a direct control feature built-in(And its free):
http://bricxcc.sourceforge.net/ (http://bricxcc.sourceforge.net/)

Other than that, you would have to learn C or Visual Basic to write your own utility to control your NXT(As the NXT cannot interface with Joysticks, Keyboards, Mice or anything else connected to the host computer)
Title: Re: Software to send PC joystick values to robot using BT (LEGO MINDSTORMS NXT)
Post by: Dino_Martino on October 04, 2010, 10:02:54 AM
Thank you for the suggestions!

Someone else coded one (python): http://principialabs.com/joystick-control-of-a-servo/ (http://principialabs.com/joystick-control-of-a-servo/).  On another note, it's probably easier to program it PC side than on the NXT... your computer has at least 100x the processing power and 10000x the memory. 
Well... My robot is quite complicated, and however I know a little bit of NXC, I want to program this one in NXT-G. I have got no PC programming experience at all, that's why I don't want to code the computer.
Perhaps I was unclear.


I am looking for a small windows program/utility (executable) that sends joystick changes to a BT apparatus connected to the PC (serial BT connection /com-port). I really want to keep all the programming about "what to do with that  joystick data" on the NXT (experience issue).

A good multipurpose/multiplatform utility that I use is RoboRealm which works with Lego Mindstorms(Both RCX and NXT), you can get a free 30-day trial on it.
http://www.roborealm.com/index.php (http://www.roborealm.com/index.php)

But you could also try NQC(I use it too), it has a direct control feature built-in(And its free):
http://bricxcc.sourceforge.net/ (http://bricxcc.sourceforge.net/)

Wich is exactly what I don't need... I have bricxcc wich also has a direct controll function. But this is useless to me, for this robot. I need more advanced functions.

The only thing usefull to me is a small windows executable that sends joystick updates to a serial bluetooth communication.
NO direct control, NO PC hand-coding.

There is no NXT specific software for this, but the concept is quite general, so the software does not have to have anything to do with the NXT at all to work...
The program should read PC joystick values, and send these to a device connected via BT, what that device is, doesn't matter.

Thank you all for the replies!
Title: Re: Software to send PC joystick values to robot using BT (LEGO MINDSTORMS NXT)
Post by: knossos on October 04, 2010, 07:02:46 PM
I don't know any utility that you could just drop in, but writing code for a joystick on the PC (yes I know you said you weren't interested) is really simple and well documented and might be the best solution.
Title: Re: Software to send PC joystick values to robot using BT (LEGO MINDSTORMS NXT)
Post by: Dino_Martino on October 05, 2010, 07:57:49 AM
I don't know any utility that you could just drop in, but writing code for a joystick on the PC (yes I know you said you weren't interested) is really simple and well documented and might be the best solution.

hmm.
If there isn't any software availible, I suppose that is my only option (besides NXTender, but it does not work on my system).
So that whould mean coding in something like C (wich whould be the easiest for me since I know NXC, a C variant), and compiling that into an .exe?
I am a complete newby in PC coding, no experience at all!

Is there perhaps another way to link a logitech joystick to an NXT (NXT-G)?
Thank you.
Title: Re: Software to send PC joystick values to robot using BT (LEGO MINDSTORMS NXT)
Post by: macdad- on October 05, 2010, 04:04:51 PM
You could still try RoboRealm and give their free trial a whirl, it does support joysticks and communicating with your NXT. That's 'bout the closest utility for your purposes.

Other than that you could just try googling "Controlling an NXT with C", and you'll be very happy to know that Microsoft offers a free IDE(Integrated Dev Enviroment) for C++, called Visual Studio C++, which is very similar to NXC.
Title: Re: Software to send PC joystick values to robot using BT (LEGO MINDSTORMS NXT)
Post by: voyager2 on October 05, 2010, 07:09:39 PM
BrixCC (the IDE for NXC) has a utility for controlling the NXT...
Go into BrixCC (make sure the brick is turned on)--->Tools--->Brick Joystick or Remote
Either one will do
Title: Re: Software to send PC joystick values to robot using BT (LEGO MINDSTORMS NXT)
Post by: Dino_Martino on October 06, 2010, 04:43:01 AM
BrixCC (the IDE for NXC) has a utility for controlling the NXT...
Go into BrixCC (make sure the brick is turned on)--->Tools--->Brick Joystick or Remote
Either one will do

I stated in my previous post that I know and use the bricxcc remote.
I also said that is not what I'm looking for.
I do NOT need direct control!
I want to relay (raw) joystick values to the NXT using BT, no control, just information.
Title: Re: Software to send PC joystick values to robot using BT (LEGO MINDSTORMS NXT)
Post by: Dino_Martino on October 06, 2010, 04:46:17 AM
You could still try RoboRealm and give their free trial a whirl, it does support joysticks and communicating with your NXT. That's 'bout the closest utility for your purposes.

Other than that you could just try googling "Controlling an NXT with C", and you'll be very happy to know that Microsoft offers a free IDE(Integrated Dev Enviroment) for C++, called Visual Studio C++, which is very similar to NXC.

Thank you. This post has been very helpful to me.
I'll certainly give it a go.
But any other suggestions still welcome!

Ps. I'm a bit surprised no one mentioned NXTender (http://www.tau.ac.il/~stoledo/lego/NXTender/ (http://www.tau.ac.il/~stoledo/lego/NXTender/))...
This does exactly what I need, but for strange reasons it does not run on my system... Perhaps I'll work to find a solution for that.
Check it out! It's an amazing piece of software!
Title: Re: Software to send PC joystick values to robot using BT (LEGO MINDSTORMS NXT)
Post by: knossos on October 06, 2010, 05:31:18 AM
You could also use LabView.  Here's a link on monitoring a joystick or a mouse (http://digital.ni.com/public.nsf/allkb/CA411647F224787B86256DD000669EFE) using LabView.  In addition you can configure it to transmit/receive serial data over com ports pretty easily.  I understand you can also use it for Bluetooth communication, but I haven't worked with Bluetooth in LabView yet.  Here's a link (http://zone.ni.com/devzone/cda/tut/p/id/3260) to get you started with Bluetooth.

--- edited for clarity
Title: Re: Software to send PC joystick values to robot using BT (LEGO MINDSTORMS NXT)
Post by: Dino_Martino on October 06, 2010, 08:28:50 AM
You could also use LabView.  Here's a link on monitoring a joystick or a mouse (http://digital.ni.com/public.nsf/allkb/CA411647F224787B86256DD000669EFE) using LabView.  In addition you can configure it to transmit/receive serial data over com ports pretty easily.  I understand you can also use it for Bluetooth communication, but I haven't worked with it yet.  Here's a link (http://zone.ni.com/devzone/cda/tut/p/id/3260) to get you started with Bluetooth.

That might work... But I prefer a free solution.
I already have NXT-G and bricxcc (wich I haven't used to it's ceiling yet), so buying another programming enviorment is a bit silly (for the moment...).
Thank you!
Title: Re: Software to send PC joystick values to robot using BT (LEGO MINDSTORMS NXT)
Post by: knossos on October 06, 2010, 09:28:38 AM
I figured as much.  That's why it wasn't my first suggestion :).  Although I've been playing with LabView (haven't done any NXT or bricxcc stuff myself) and I'm liking it a lot so far.


-- edited for typo
Title: Re: Software to send PC joystick values to robot using BT (LEGO MINDSTORMS NXT)
Post by: Dino_Martino on October 06, 2010, 11:22:37 AM
I figured as much.  Thats why it wasn't my first suggestion :).  Although I've been playing with LabView (haven't done any NXT or stuff myself) and I'm liking it a lot so far.

I could ask another 1000 questions about that, but I'm sure I can find the answers somewhere on the web. I'll check things out in the weekend. I'll either try to fix NXTender, or search for another piece of freeware.

Thank you very much for your help!
--ps. any other suggestions still welcome!:)
Title: Re: Software to send PC joystick values to robot using BT (LEGO MINDSTORMS NXT)
Post by: Dino_Martino on October 17, 2010, 04:22:20 AM
I finally got NXTender to work, problem solved.
I'm embarrased to tell how I solved it...

In the windows enviorment-variable "PATH", I forgot to type ";" at the end...
A small mistake...:-[ , But that's why NXTender dind't recognice the call to "java"...

Anyway, Thanks a lot for your help!