How to setup Nvidia Drivers and CUDA in Ubuntu

Disabling Nouveau, if required (login loop or low res mode), otherwise skip to next section

  1. Confirm nouveau is loaded

lsmod | grep -i nouveau

You’ll see the text nouveau in the 4th column, if loaded

video XXXX Y nouveau

  1. If nouveau is loaded then blacklist it. Create the file blacklist-nouveau.conf in /etc/modprobe.d/

sudo nano /etc/modprobe.d/blacklist-nouveau.conf

And add the following text

blacklist nouveau
options nouveau modeset=0
  1. Execute sudo update-initramfs -u

  2. Restart

NVIDIA Driver Setup

  1. Download the RUN file from NVidia’s website
    https://www.geforce.com/drivers
    You’ll have a file named similarly to NVIDIA-Linux-x86_64-XXX.YY.run

  2. Assign execution permissions chmod +x NVIDIA-Linux-x86_64-XXX.YY.run

  3. Move to a virtual console pressing Ctrl+Alt+F1 and login

  4. Terminate the X Server executing sudo service lightdm stop

  5. Run the installer sudo ./NVIDIA-Linux-x86_64-XXX.YY.run
    (If you are running on a laptop run instead sudo ./NVIDIA-Linux-x86_64-XXX.YY.run --no-opengl-files)

  6. Follow the instruction from the wizard. At the end, do not allow the wizard to modify the X configuration.

  7. Once back in the console, execute sudo service lightdm start. The GUI should be displayed. Login.

  8. To confirm everything is set run in a terminal nvidia-smi

CUDA Setup

  1. Download the CUDA Installation RUN File from https://developer.nvidia.com/cuda-downloads
    You’ll have a file named similarly to cuda_X.0.YY.Z_linux.run

  2. Assign execution permissions chmod +x cuda_X.0.YY.Z_linux.run

  3. Run the installer sudo ./cuda_X.0.YY.Z_linux.run

  4. Follow the instructions on screen. DO NOT install the NVIDIA Driver included. Install the CUDA Samples on your home directory.

  5. Once finished, to confirm everything is ok. Go to your home directory and execute cd NVIDIA_CUDA-X.Y_Samples/1_Utilities/deviceQuery Match X, Y to your CUDA version. i.e. CUDA 9.0 cd NVIDIA_CUDA-9.0_Samples/1_Utilities/deviceQuery

  6. Compile the sample running make

  7. Run the sample ./deviceQuery you should see the details about your GPU(s) and CUDA Setup.

How to setup IMU XSense MTI

Check the assigned USB device to the IMU using dmesg

[ 8808.219908] usb 3-3: new full-speed USB device number 28 using xhci_hcd
[ 8808.237513] usb 3-3: New USB device found, idVendor=2639, idProduct=0013
[ 8808.237522] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 8808.237527] usb 3-3: Product: MTi-300 AHRS
[ 8808.237531] usb 3-3: Manufacturer: Xsens
[ 8808.237534] usb 3-3: SerialNumber: 03700715
[ 8808.265957] usbcore: registered new interface driver usbserial
[ 8808.265982] usbcore: registered new interface driver usbserial_generic
[ 8808.265999] usbserial: USB Serial support registered for generic
[ 8808.268037] usbcore: registered new interface driver xsens_mt
[ 8808.268048] usbserial: USB Serial support registered for xsens_mt
[ 8808.268063] xsens_mt 3-3:1.1: xsens_mt converter detected
[ 8808.268112] usb 3-3: xsens_mt converter now attached to ttyUSB0
  1. Change permissions of the device chmod a+rw /dev/ttyUSB0 Probably is USB0, change it accordingly to your setup
  2. In an Autoware sourced terminal execute: rosrun xsens_driver mtdevice.py -m 2 -f 100
    (this configures the IMU to publish raw data from the sensor at 100Hz)
    To publish data execute (in a sourced terminal):
    rosrun xsens_driver mtnode.py _device:=/dev/ttyUSB0 _baudrate:=115200
  3. Confirm data is actually coming using rostopic echo /imu_raw in a different terminal