NvROS

Hi,

Just wondering whether NvROS is based on ROS or ROS2?

Thanks!

Dear VerySimple,

NvROS is based on ROS1-Kinetic. Thanks.

Thanks

Hello SteveNV,

If I use SDK Manager to flash Xavier with DRIVE 10.0, is the NvROS also based on ROS1-Kinetic? or it has been upgraded to ROS1-Melodic?

Thanks!

Dear hanyang.zhuang,

Drive Software 10.0 contains the ROS1-K frameworks not ROS1-M. Thanks.

Hi SteveNV,

I found in the tutorial about the NvROS in
https://docs.nvidia.com/drive/drive_os_5.1.12.0L/nvvib_docs/index.html#page/DRIVE_OS_Linux_SDK_Development_Guide%2FBootloader%2Frobot_os.html%23wwpID0E0HZ0HA

But I’m still quite confused of how to implement it. Currently, my requirement is straight forward:
On host, I will initiate a ros master and a rosnode to play rosbag or use simulation software generate realtime rostopics. The rostopics include sensor data and vehicle operation data.
I would like to cross compile ROS or use NvROS on the Xavier System so that my controller can receive the rostopics, use DriveWorks to process the data, and send rostopics back to my host.

Would you please help explain more about which approach shall I take and what tools do I need?

Thanks a lot!

Dear hanyang.zhuang,
Could you please refer to the following link for the question? Thanks.
https://devtalk.nvidia.com/default/topic/1068379/general/ros-with-driveworks-on-xavier-compilation-and-runtime-issues/

Hi SteveNV,

Thanks for your reply. I have installed ROS on my target and run it properly. However, there is some problem when I use host to cross-compile files using roscpp. I have opened another thread about it. So here I only would like to discuss more in NvRos.

If you compare following two links:
https://docs.nvidia.com/drive/drive_os_5.1.6.1L/nvvib_docs/DRIVE_OS_Linux_SDK_Development_Guide/baggage/modules.html
https://docs.nvidia.com/drive/drive_os_5.1.12.0L/nvvib_docs/DRIVE_OS_Linux_SDK_Development_Guide/baggage/modules.html
They are different about NvROS module. DRIVE OS 5.1.6 has no information about NvROS and DRIVE OS 5.1.12 has the information about NvROS.

However, the question is I am using latest SDKmanager to install 10.0 to my host and target. Then the latest version of DRIVE OS is 5.1.6 which means it DOES NOT have NvROS. Can you help to figure out if I am not installing DRIVE OS correctly, or the NvROS module is not released yet? Thanks in advance!

Hi hanyang.zhuang,

Drive SW releases is not intended to contain NvROS. That’s why DRIVE OS 5.1.6.1 development guide (for DRIVE OS in DRIVE Software 10.0) also has no the NvROS section inside. Thanks!

Hi Vick,

Thanks for your feedback. Then if I would like to use NvROS, how can I install and use it?

May I know why you need NvROS? Can you implement your own ROS nodes for your use cases with DRIVE OS APIs or DriveWorks API?

Hi Vick,

The main reason is that I do not know how to cross-compile my code which includes ros and driveworks. By following your guidance in this thread, I have installed ROS follows the thread
https://devtalk.nvidia.com/default/topic/1032206/faq/drive-px2-ros-cross-compilation/post/5251406/
I have successfully installed ROS in /home/zhy/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_E3550/DRIVEOS/drive-t186ref-linux/targetfs_a. However, I’m not very familiar with cmake and how to modify toolchain, so I would rather to simply include /opt/ros/melodic/indclude and the libraries in my CMakeLists.txt which looks like this. Because I think it’s too complicated to merge catkin_make DriveWorks CMakeLists and cakint workspace CMakeLists.

CMakeLists.txt

project(ros_node C CXX)

set( Boost_DEBUG ON )
include_directories(
	${VIBRANTE_PDK}/targetfs_a/usr/include/aarch64-linux-gnu
	${VIBRANTE_PDK}/targetfs_a/opt/ros/melodic/include
) 
link_directories( ${VIBRANTE_PDK}/targetfs_a/usr/lib)
link_directories( ${VIBRANTE_PDK}/targetfs_a/opt/ros/melodic/lib)

set(PUBLIC_DOCS
    README.md
)

set(SOURCES
    ros_node.cpp
)

set(LIBRARIES
	boost
	roscpp
	rosconsole
	roscpp_serialization
	rostime
    samples_framework
    ${Driveworks_LIBRARIES}
)

#-------------------------------------------------------------------------------
# Final target
#-------------------------------------------------------------------------------
add_executable(${PROJECT_NAME} ${SOURCES})
target_link_libraries(${PROJECT_NAME} PRIVATE ${LIBRARIES})
set_property(TARGET ${PROJECT_NAME} PROPERTY FOLDER "Samples")

# ------------------------------------------------------------------------------
# Install target
# ------------------------------------------------------------------------------
sdk_add_sample(${PROJECT_NAME})
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-V5L.cmake \
-DVIBRANTE_PDK:STRING=/home/zhy/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_E3550/DRIVEOS/drive-t186ref-linux \
..
make -j && make install

But this does case a lot of errors such as:
Errors

/home/zhy/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_E3550/DRIVEOS/toolchains/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/aarch64-linux-gnu/include/c++/7.3.1/cwchar:146:11: error: ‘::fwide’ has not been declared
   using ::fwide;
           ^~~~~
/home/zhy/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_E3550/DRIVEOS/toolchains/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/aarch64-linux-gnu/include/c++/7.3.1/cwchar:147:11: error: ‘::fwprintf’ has not been declared
   using ::fwprintf;
           ^~~~~~~~
/home/zhy/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_E3550/DRIVEOS/toolchains/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/aarch64-linux-gnu/include/c++/7.3.1/cwchar:148:11: error: ‘::fwscanf’ has not been declared
   using ::fwscanf;
           ^~~~~~~
/home/zhy/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_E3550/DRIVEOS/toolchains/gcc-linaro-7.3.1-2018.05-x86_64_aarch64-linux-gnu/aarch64-linux-gnu/include/c++/7.3.1/cwchar:149:11: error: ‘::getwc’ has not been declared
   using ::getwc;
..........
In file included from /home/zhy/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_E3550/DRIVEOS/drive-t186ref-linux/targetfs_a/usr/include/aarch64-linux-gnu/boost/math/special_functions/fpclassify.hpp:20:0,
                 from /home/zhy/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_E3550/DRIVEOS/drive-t186ref-linux/targetfs_a/usr/include/aarch64-linux-gnu/boost/math/special_functions/round.hpp:16,
                 from /home/zhy/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_E3550/DRIVEOS/drive-t186ref-linux/targetfs_a/opt/ros/melodic/include/ros/time.h:58,
                 from /home/zhy/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_E3550/DRIVEOS/drive-t186ref-linux/targetfs_a/opt/ros/melodic/include/ros/serialization.h:34,
                 from /home/zhy/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_E3550/DRIVEOS/drive-t186ref-linux/targetfs_a/opt/ros/melodic/include/std_msgs/String.h:14,
                 from /home/zhy/Desktop/dwTests/src/ros_node/ros_node.cpp:40:
/home/zhy/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_E3550/DRIVEOS/drive-t186ref-linux/targetfs_a/usr/include/aarch64-linux-gnu/boost/math/special_functions/detail/fp_traits.hpp: In static member function ‘static void boost::math::detail::fp_traits_non_native<float, boost::math::detail::single_precision>::get_bits(float, uint32_t&)’:
/home/zhy/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_E3550/DRIVEOS/drive-t186ref-linux/targetfs_a/usr/include/aarch64-linux-gnu/boost/math/special_functions/detail/fp_traits.hpp:187:55: error: ‘memcpy’ is not a member of ‘std’
     static void get_bits(float x, uint32_t& a) { std::memcpy(&a, &x, 4); }
                                                       ^~~~~~
/home/zhy/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_E3550/DRIVEOS/drive-t186ref-linux/targetfs_a/usr/include/aarch64-linux-gnu/boost/math/special_functions/detail/fp_traits.hpp:187:55: note: suggested alternative: ‘decay’
     static void get_bits(float x, uint32_t& a) { std::memcpy(&a, &x, 4); }
                                                       ^~~~~~
                                                       decay
/home/zhy/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_E3550/DRIVEOS/drive-t186ref-linux/targetfs_a/usr/include/aarch64-linux-gnu/boost/math/special_functions/detail/fp_traits.hpp: In static member function ‘static void boost::math::detail::fp_traits_non_native<float, boost::math::detail::single_precision>::set_bits(float&, uint32_t)’:
/home/zhy/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_E3550/DRIVEOS/drive-t186ref-linux/targetfs_a/usr/include/aarch64-linux-gnu/boost/math/special_functions/detail/fp_traits.hpp:188:55: error: ‘memcpy’ is not a member of ‘std’
     static void set_bits(float& x, uint32_t a) { std::memcpy(&x, &a, 4); }
                                                       ^~~~~~
/home/zhy/nvidia/nvidia_sdk/DRIVE_Software_10.0_Linux_OS_E3550/DRIVEOS/drive-t186ref-linux/targetfs_a/usr/include/aarch64-linux-gnu/boost/math/special_functions/detail/fp_traits.hpp:188:55: note: suggested alternative: ‘decay’
     static void set_bits(float& x, uint32_t a) { std::memcpy(&x, &a, 4); }
                                                       ^~~~~~
                                                       decay

Therefore, I think I’m not doing it correctly. So my question is that do I have to write my toolchain cmake file as indicated in aforementioned url and use catkin_make_isolated to cross-compile it? Is there to be some possibly easier approach to use ros?
Thanks!

You can refer to http://wiki.ros.org/ROS/Tutorials/CreatingPackage and start from developing a simple driveworks ROS node. It will be more easy.

If you want to manipulate an CMAKE_TOOLCHAIN_FILE for your projects, you may need to use catkin_make_isolated as an alternative for catkin_make.

Hi VickNV,

I have succeeded in using ROS node and DW in host compilation. I follow the instruction to modify my CMAKE_TOOLCHAIN_FILE and apply catkin_make_isolated so the ROS node can communicate with rosmaster and also utilize DW functions.

However, when it comes to cross compilation, the modification of CMAKE_TOOLCHAIN_FILE is much more complicated and there are too many errors. Since there are already many autonomous driving system or simulation software using ROS, I strongly recommended Nvidia to provide a simple example to cross compile ROS node and DW for the target Xavier.

I’m using the simplest ROS node as http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29.
And also the hello_world sample.
The sample here only tells how to cross compile ROS node alone. https://devtalk.nvidia.com/default/topic/1032206/faq/drive-px2-ros-cross-compilation/post/5251406/

Could you start from http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29 only?

After that, when you try to add hello_world package, the main things should be to manipulate its CMakeLists.txt with necessary include_directories and target_link_libraries. Below are snippets of self-documenting CMakeLists.txt generated by catkin_create_pkg tool.

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
# include
# ${catkin_INCLUDE_DIRS}
)
...
## Specify libraries to link a library or executable target against
# target_link_libraries(${PROJECT_NAME}_node
#   ${catkin_LIBRARIES}
# )

Hi VickNV,

This issue is resolved now and what you have provided is exactly what I have done. Thanks a lot!