realtime autonomous car for studying and ros2 cross compiling
Post on 12-Feb-2017
331 Views
Preview:
TRANSCRIPT
Realtime autonomous car for and ROS2 cross compiling
Jim Huang – National Cheng Kung UniversityColin Cheng – Providence University
Johnson Chang - National Chiao Tung UniversityAhua Wang - National Cheng Kung UniversityEdison Chen - National Cheng Kung UniversityJason Haung - National Cheng Kung University
duckiebot (From MIT)
Lane following
Original image
Homography transform
Line detection
w
Lane control procedure
Do color thresholding to extract the desired color area
Do canny edge detection
Do hough transform and get the segments
Apply Lane filter to get the best lane estimation
Do PID control
Original kernel
Latencymin: 4 (μs)
Avg: 206 (μs) Max: 159001 (μs)
Xenomai patched kernel
Latency:Min: 2 (μs)Avg: 11 (μs)Max: 36 (μs)
ROS2 cross compiling
Tested environment
Target Machine: Raspberry pi 3
Host operating system: Ubuntu 16.04Target operating system: Ubuntu Mate 16.04Cross compiler: Linaro GCC 5.3
CMakeCmake is compatible to do cross compile by setting some variables like:
CMAKE_SYSTEM_NAMECMAKE_C_COMPILERCMAKE_CXX_COMPILERCMAKE_SYSROOT
Please check:http://www.vtk.org/Wiki/CMake_Cross_Compiling
CMake
Please check:
https://github.com/ncku-ros2-research/cross-compile-ros2/blob/master/ros2_ws/rostoolchain.cmake
ROS2 for ARM machine
ROS2 alpha7+ require compiler able to compile C++11 program
And C++11 is only fully support on ARMv6+ machine
Root file systemThe symlink in rootfs directory will broken after copied from target machine because it used to point to an absolute path like: “/usr/lib/libxxx.so” but it is now locate to some path like “~/workspace/rootfs/usr/lib/libxxx.so”
This is quite tricky but can be fixed by writing a shell script
Root file system
Please check:
https://github.com/ncku-ros2-research/cross-compile-ros2/blob/master/tools/fixQualifiedLibraryPaths
Toolchain
Linaro GCC 5.3 (Newest release version right now)
Not recommand to build your own cross compiler (e.g: crosstool-ng)
Pkg-config wrapper
Few pkg-config’s environment variables need to be set for cross compiling purpose
PKG_CONFIG_LIBDIRPKG_CONFIG_SYSROOT_DIR
Pkg-config wrapper
#!/bin/bash#pkg-config wrapperROOTFS=$(realpath ../rootfs)ROS2_WS_PATH=$(realpath ../ros2_ws)
export PKG_CONFIG_DIR=export PKG_CONFIG_LIBDIR=${ROS2_WS_PATH}/install/lib/pkgconfig:${ROOTFS}/usr/lib/arm-linux-gnueabihf/pkgconfig:${ROOTFS}/opt/ros/kinetic/lib/pkgconfig:${ROOTFS}/usr/lib/pkgconfigexport PKG_CONFIG_SYSROOT_DIR=${ROOTFS}
pkg-config $@
Multi-ArchDebian/Ubuntu use multi-arch design and store the libraries in directories like: /usr/lib/arm-none-eabihf
In order to let compiler search these directories, the output message of command “arm-none-eabihf-gcc --print-multiarch” must be set
Native build as alternateSolution (add swap memory)1) $ sudo apt install dphys-swapfile2) $ vi /etc/dphys-swapfile add CONF_SWAPSIZE=40963) $ /etc/init.d/dphys-swapfile stop4) $ /etc/init.d/dphys-swapfile start
Use “htop” to check for new swap memory
LinksDuckietownhttp://duckietown.mit.edu/
Github:https://github.com/ncku-ros2-research/cross-compile-ros2
Slidehttps://www.slideshare.net/secret/BjQIsw6iifmzRa
top related