Difference between revisions of "LEGO IGT Compilation"

From NAMIC Wiki
Jump to: navigation, search
Line 55: Line 55:
 
The simplest way to use this library is to keep the four NXT_USB files (NXT_USB.h, NXT_USB.cxx, NXT_USB_linux.h, and NXT_USB_linux.cxx) in the same directory as your program.  Simply #include "NXT_USB.h" and compile as usual.
 
The simplest way to use this library is to keep the four NXT_USB files (NXT_USB.h, NXT_USB.cxx, NXT_USB_linux.h, and NXT_USB_linux.cxx) in the same directory as your program.  Simply #include "NXT_USB.h" and compile as usual.
  
== Windows Installation ==
+
= Windows Installation =
 +
 
 +
 
  
  
 
Contact information:
 
Contact information:
 
I would be more than happy to reply to any questions and comments emailed to dpace [at] bwh.harvard.edu.
 
I would be more than happy to reply to any questions and comments emailed to dpace [at] bwh.harvard.edu.

Revision as of 14:20, 25 June 2008

Home < LEGO IGT Compilation

NXT_USB is a C++ library used to control a LEGO Mindstorms NXT robot over a USB connection.

This code was modified from:

Linux Installation

Reqirements

  1. This code can be used only on a Linux distribution with root access. Remember to run any software utilizing this code as root.
  2. libusb: http://libusb.sourceforge.net/

Instructions

Download libusb from:

 http://libusb.sourceforge.net (version 0.1.12)

Then run:

 tar zxvf libusb-0.1.12.tar.gz
 cd libusb-0.1.12/
 ./configure CFLAGS=-funsigned-char --prefix=<your libusb directory> --exec-prefix=<your libsub directory>
 make
 make install

Then add the libusb directory to your $LD_LIBRARY_PATH variable. Note that the INSTALL.libusb file has information about the installation process.

Another alternative is to use CMake:

 SET(CMAKE_CXX_FLAGS
   "-funsigned-char"
 )
 INCLUDE_DIRECTORIES(
   ...
   <your libusb directory (can be a relative path)>
 )
 ADD_LIBRARY(<your library name>
   ...
   NXT_USB.cxx
   NXT_USB_linux.cxx
 )
 FIND_LIBRARY(LIBUSB_LIB
   NAMES libusb-lib
   PATHS
    <your libusb directory (can be a relative path)>/lib
 )
 TARGET_LINK_LIBRARIES(Lego
   ...
   <your libusb directory (should be an absolute path)>/lib/libusb.so
 )

The simplest way to use this library is to keep the four NXT_USB files (NXT_USB.h, NXT_USB.cxx, NXT_USB_linux.h, and NXT_USB_linux.cxx) in the same directory as your program. Simply #include "NXT_USB.h" and compile as usual.

Windows Installation

Contact information: I would be more than happy to reply to any questions and comments emailed to dpace [at] bwh.harvard.edu.