Remote control of motors using C/C++

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
ubertron
Posts: 1
Joined: 28 Jan 2011, 14:31

Remote control of motors using C/C++

Post by ubertron »

Hi,

I'm wondering if the NXT motors can be controlled using a c/c++ program in real time. I have a project that contains several other c++ files which basically layout a maze for the robot to follow. I would like to read in the encoder values so that the numbers can be used in my other source files to calculate where in the maze the robot currently is. Then depending on the location in the maze i want to be able to send motor controls back to the robot. (all done through USB).

I'm basically setting up a maze for my robot to go through, only its all virtual. If this can not be done using the NXT controller brick any recommendations of how to do it with a different controller? i know adrinuo and legos popular but i dont know if adrinuo can be controlled this way either.


Any ideas?
Thanks
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: Remote control of motors using C/C++

Post by mightor »

Please use sensible post subjects, rather than "HELP". I've changed it on your post.

- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
lizard381
Posts: 44
Joined: 16 Nov 2010, 19:57

Re: Remote control of motors using C/C++

Post by lizard381 »

Lego has provided their API, and using their API it is possible to write code in C++ that will control your robot from your pc...but I'm not sure about having that code on the NXT brick. I know I've seen projects, like NXT OSEK (http://lejos-osek.sourceforge.net/whatislejososek.htm) that should allow you to have the code on your NXT, but I haven't tried this personally. Perhaps someone in the forums has and can report back with their experience? The only downside is that it's Windows only, no Mac support, no official Linux support.

Kami
I haven't grown past my playing with Legos stage and I don't think I want to :)
Blog: http://nuhlikklebickle.blogspot.com
Kami
h-g-t
Posts: 552
Joined: 07 Jan 2011, 08:59
Location: Albania

Re: Remote control of motors using C/C++

Post by h-g-t »

You can command the motors and sensors through the Bricx Center (http://bricxcc.sourceforge.net/) so possibly you could incorporate code from that into your own program.

OnBrick (http://www.pspwp.pwp.blueyonder.co.uk/s ... index.html) also allows remote operation of the NXT from a computer or pda so that code might be useful as well.

Googling 'remote operation of lego nxt' got a few hits as well.
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
dsjove
Posts: 56
Joined: 22 Jan 2011, 23:22

Re: Remote control of motors using C/C++

Post by dsjove »

LEGO's driver has a C++ interface that lets you control the robot in realtime. It is available in Windows and on the Mac (not certain about Linux).
LEGO.com, Products, Mindstorms, Support, Files, Software Dev kits.
Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests