Cross Compiling Driveworks on the PX2 with ROS

What is the normal setup for cross compiling ros nodes that use the Driveworks platform for the Drive PX2?
I am currently trying to cross compile ros-kinetic from source using the cmake toolchain file provided in the Driveworks samples and working through boost dependency issues.
Earlier responses to posts about ros hinted that Nvidia was working on a guide for using ros with the PX2. What is its status? Are you waiting for the cross compiling setup to be migrated to 16.04? If a draft of this was available I would be willing to test it and give feedback.

I ended up getting all the way past cross compiling python and boost. However once ros started linking against python libraries there is an error “final link failed: Nonrepresentable section on output”

I am hoping there will be a guide for this soon as cross compiling each individual dependency seems to be very error prone and time consuming. There has to be a better way…

Is there a general strategy for how to compile ros binaries that link in some driveworks binaries? I don’t need a guide just a better strategy for how to do this.

Hello llorenzds,

Please refer to below to install ROS-Kinetic on DPX2.

  1. Install the PDK and flash the target build onto the board as described in the PDK Developer’s Guide

  2. Boot to Ubuntu Unity Desktop
    Note: Do not perform “apt-get upgrade” on the target, at any stage

  3. Via Ubuntu GUI, configure Ubuntu to allow package installation from main, restricted, universe and multiverse repositories

  4. Setting locale:
    (This is optional. Setting locales explicitly to either of the options mentioned may cause some issues with launching the terminal after a system reboot. So, this step may be skipped in the first try)
    sudo update-locale LANG=C LANGUAGE=C LC_ALL=C LC_MESSAGE=POSIX
    (or)
    export LANGUAGE=en_US.UTF-8
    export LANG=en_US.UTF-8
    export LC_ALL=en_US.UTF-8
    sudo locale-gen en_US.UTF-8
    sudo dpkg-reconfigure locales

  5. Setup the keys to authenticate package downloads
    sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116

  6. Open the ‘Software & Updates’ applet and add
    deb http://packages.ros.org/ros/ubuntu xenial main

  7. Update the libssl1.0.0 package to the latest version [1.0.2g-1ubuntu4.6]and install libssl-dev
    sudo apt-get install libssl1.0.0/xenial libssl-doc/xenial libssl-dev/xenial

  8. Install the ‘Desktop’ bundle of ROS (contains the ROS Core Framework, plus a set of popular algorithms and sample apps)
    sudo apt-get install ros-kinetic-desktop

  9. After successful installation of ROS, set up the environment so that the terminal recognizes ROS.
    echo “source /opt/ros/kinetic/setup.bash” >> ~/.bashrc
    source ~/.bashrc

  10. Set the library search path for the current shell
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib:/usr/lib/aarch64-linux-gnu

  11. Run some ROS sample apps to verify install success. For example:
    VISUALIZING THE ROS TURTLESIM APP WITH RVIZ

    1. From a terminal, run
      roslaunch turtle_tf turtle_tf_demo.launch
    2. In a new terminal, run
      rviz &
    3. After launching the rviz GUI, change the Fixed frame (found under ‘Global Options’ in the ‘Displays’ section) to ‘world’.
    4. From the display section, Add > By display type > TF
    5. To verify successful connectivity between the turtlesim application and rviz,
      move the turtle on the terminal used to run roslaunch (Step1 above) and observe the movement of the turtle frames with respect to the world frame in the rviz GUI
1 Like

hi llorenzds,

i believe its not necessary to cross compile all along ros and driveworks.
It should be enough to cross compile nvidia libs and later link them accordingly to ROS pkgs.

So in the final process you just run catkin_make on the target and link the required libs against.

Please correct me if i am wrong here.

FYI, I am also interessted in a proper setup here, especially for getting the gmsl cameras within ROS.

@SteveNV

Thanks for the info. I have a ros Kinetic setup on the Drive PX2 that works. I am just trying to figure out a good solution for linking in the Driveworks libraries with custom ros code.

@tinokl

I have been thinking along similar lines, especially since the Driveworks cross compiling setup is pretty complex. One test that I am working on today is seeing if I can compile a ros node natively on the Drive PX2 that links in one of the Driveworks libraries. As far as I can tell the Driveworks libraries already exist in the Drive PX2’s file system. I will try to keep this thread up to date with my setup, it would be nice to come up with a good solution to this.

@tinokl @SteveNV

I have managed to get a working wrapper around the driveworks lane detection binaries by developing on the drive px2. I will try to replicate this tomorrow on the second tegra of the px2, so that I can make a simple guide for this. Thanks for the help!

I was hoping to document this well but haven’t taken the time. Most of the configuration needed is in the CMakeLists. Here is a link to the changes I made, https://gist.github.com/linknum23/153c508f2610f4b4fd4fae39aa8f862b I hope this helps.

I have a bit of problems using your CMake file…

The folder /usr/share/visionworks/sources/3rdparty/nvmedia/ doesn’t exist on my system!?
I only found nvmedia headers and libs in VibranteSDK/vibrante-t186ref-linux, but system tells me they are incompatible.

Any suggestions?

My system is Ubuntu 16.04.3 LTS

Update:
Think I am wrong trying to compile it on my host machine?
Only possible on PX2 itself?

That setup is for compiling on the PX2 itself. It would have been much harder for me to get a cross compiling setup working.

Ok, thats annoying… ;)
So you write your code on your notebook without compiling?
Or do you just compile for x64 to see if any errors are present and then push the source to the PX2?

I just ssh into the px2 and compile. I use x forwarding to use my favorite ide after installing it on the px2.

I am trying to get the wrapper working to compile ROS with the Driveworks libraries included on the PX2 and changed the cmakelist according to https://gist.github.com/linknum23/153c508f2610f4b4fd4fae39aa8f862b
But I can not figure out this error message. Has anyone encountered a similar problem or has any suggestions?

/usr/bin/ld: /home/nvidia/catkin_ws/src/pkg_test/3rdparty/linux-aarch64/glfw-3.1.1/lib/libglfw3.a(x11_window.c.o): undefined reference to symbol ‘XConvertSelection’
/usr/lib/gcc/aarch64-linux-gnu/5/…/…/…/aarch64-linux-gnu/libX11.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
pkg_test/CMakeFiles/pkg_test.dir/build.make:146: recipe for target ‘/home/nvidia/catkin_ws/devel/lib/pkg_test/pkg_test’ failed
make[2]: *** [/home/nvidia/catkin_ws/devel/lib/pkg_test/pkg_test] Error 1
CMakeFiles/Makefile2:825: recipe for target ‘pkg_test/CMakeFiles/pkg_test.dir/all’ failed
make[1]: *** [pkg_test/CMakeFiles/pkg_test.dir/all] Error 2
Makefile:138: recipe for target ‘all’ failed
make: *** [all] Error 2
Invoking “make -j6 -l6” failed

Have you tried building a simple project? This was used to create a wrapper around the lane detector that piped the lane detection results into ros. I didn’t ever use this to create anything that required a gui.

yes building simple projects is working but I can not figure out how to build one that includes a gui. Currently I am trying to get the cross compilation to work but I have not gotten too far with it yet. Has anyone a suggestion how it could work?

@SteveNV

I tried your procedure to install ROS Kinectic on my freshly flashed Drive PX2 and I get the following message at step 8 (sudo apt-get install ros-kinetic-desktop).

Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
ros-kinetic-desktop : Depends: ros-kinetic-common-tutorials but it is not going to be installed
Depends: ros-kinetic-geometry-tutorials but it is not going to be installed
Depends: ros-kinetic-robot but it is not going to be installed
Depends: ros-kinetic-ros-tutorials but it is not going to be installed
Depends: ros-kinetic-visualization-tutorials but it is not going to be installed
Depends: ros-kinetic-viz but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Do you have any idea? I swear I did not perform “apt-get upgrade” on the target, at any stage… But I did perform a “apt-get update”.

@mlandry
I would recommend removing ros-kinetic-desktop-full and installing ros-kinetic-base, along with the packages you actually need to run on the PX2. This will avoid your problems with the missing packages. Remember you want to use the PX2 as a compute platform not a normal laptop/desktop computer…
Visualization tools like rviz can be run on a second computer on the same network as the PX2 with the roscore running on the PX2.

@llorenzds

Yeah I know I was just following the posted official procedure… I also tried ROS bare bone which gives me these dependencies problems instead… I have a Drive PX2 Autochauffeur with the Beta 1.0 PDK installed. I will try my luck by downloading and flashing the Alpha 2.0 PDK instead…

nvidia@tegra-ubuntu:~$ sudo apt-get install ros-kinetic-ros-base
Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
ros-kinetic-ros-base : Depends: ros-kinetic-actionlib but it is not going to be installed
Depends: ros-kinetic-bond-core but it is not going to be installed
Depends: ros-kinetic-class-loader but it is not going to be installed
Depends: ros-kinetic-dynamic-reconfigure but it is not going to be installed
Depends: ros-kinetic-nodelet-core but it is not going to be installed
Depends: ros-kinetic-pluginlib but it is not going to be installed
Depends: ros-kinetic-ros-core but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Hi,

I was following SteveNV instruction on how to install ROS on the Drive PX2, and I get error message below after step 8.

sudo apt-get install ros-kinetic-desktop
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 ros-kinetic-desktop : Depends: ros-kinetic-viz but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

By the way, I added the deb repo using the command line:

sudo add-apt-repository 'deb http://packages.ros.org/ros/ubuntu xenial main'

as the ‘Software & Update’ GUI is giving me an error as well.

Any help.