Skip to content

Latest commit

 

History

History
121 lines (102 loc) · 3.96 KB

11-ros-dev.md

File metadata and controls

121 lines (102 loc) · 3.96 KB

Guide to Cross Compilation for a Raspberry Pi

  1. Start
  2. Setup XCS and RPi
  3. Setup RPi Network and SSH
  4. Setup RPi Peripherals
  5. Setup Cross-compile environment
  6. Cross-compile and Install Userland
  7. Cross-compile and Install OpenCV
  8. Cross-compile and Install ROS
  9. Compile and Install OpenCV
  10. Compile and Install ROS
  11. Remote ROS (RPi node and XCS master)
  12. > ROS package development (RPi/XCS)
  13. Compile and Install WiringPi

12. ROS package development (RPi/XCS)

TO BE UPDATED. GUIDE MIGHT STILL WORK.

The scripts to source the ROS-builds on both the RPi and VM expect paths in which a package is build. Both ros-native and ros-cross search for the devel* folders created bij the ROS builders.

For native building, packages need to be build in:

XCS~$ ~/build/ros/<packagename>

For cross compilation, packages need to be build in:

XCS~$ ~/ros/<packagename>_cross

After cross-compiling a package for the RPi, the ~/ros directory needs to be synchronised with the RPi via:

XCS~$ ~/rpicross_notes/scripts/sync-ros.sh

The source of a package can be located everywhere.

Prerequisites:

Optional:

Native-compilation

  1. Set correct paths for native compilation
    XCS~$ source ~/rpicross_notes/scripts/ros-native
    
  2. Build package
    XCS~$ mkdir -p ~/build/ros/<packagename>
    XCS~$ cd ~/build/ros/<packagename>
    XCS~$ cmake <path>/<to>/<package>
    XCS~$ make
    
  3. Update ROS-paths, so new package is included
    1. Via generic script:

      XCS~$ source ~/rpicross_notes/scripts/ros-native  <hostname> <rpiname>
      

      <hostname> and ` are optional and only needed when a RPi is used. See Testing.

    2. or, build package only:

      XCS~$ source ~/build/ros/<packagename>/devel/setup.bash
      
  4. Assuming a roscore is running, the package can be started via rosrun:
    XCS~$ rosrun <packagename> <node>
    

Cross-compilation

  1. Set correct paths for cross compilation

    XCS~$ source ~/rpicross_notes/scripts/ros-cross
    
  2. Build package

    XCS~$ mkdir -p ~/ros/<packagename>
    XCS~$ cd ~/ros/<packagename>
    XCS~$ cmake \
        -DCMAKE_TOOLCHAIN_FILE=/home/pi/rpicross_notes/rpi-generic-toolchain.cmake \
        <path>/<to>/<package>
    XCS~$ make
    
  3. Update RPi

     XCS~$ ~/rpicross_notes/scripts/sync-ros.sh <rpi-host>
    

    <rpi-host> is optional. When omitted, rpizero-local is used.

  4. Assuming a roscore is running, the package can be started via rosrun:

    XCS~$ ssh rpizero-local
    RPi~$ rosrun <packagename> <node>
    

Mixed

When a mixed setup is used, e.g. when both the VM and RPi need to be active, the following command should be executed before logging-in to the RPi or starting a node on either the VM or RPi:

XCS~$ source ~/rpicross_notes/scripts/ros-native <hostname> <rpiname>
  • <hostname>: hostname of device on which roscore runs.
    1. when VM: name of HOST~$
    2. when RPi: name of RPi

    detect the hostname with the hostname command

  • <rpiname>: name of ssh-connection defined in ssh_config of the RPi