====== Installing ROS Melodic & ROS Dashing inside a Ubuntu Bionic chroot ====== * Install Ubuntu inside a chroot. Follow guide from [[tutorials:ubuntu_bionic_chroot|here]] * Fix /etc/resolv.conf nameserver 8.8.8.8 * Fix /etc/hosts. On the second line put the name of your hostname instead of 'shirka'. 127.0.0.1 localhost 127.0.1.1 shirka * Add all ubuntu repositories. Edit file /etc/apt/sources.list: deb http://mirrors.ucr.ac.cr/ubuntu bionic main universe restricted multiverse deb http://mirrors.ucr.ac.cr/ubuntu bionic-updates main universe restricted multiverse deb http://mirrors.ucr.ac.cr/ubuntu bionic-backports main restricted multiverse * Update repos $ apt-get update * Install the following packages: $ apt-get install sudo mc nano curl lsb-release gnupg2 apt-utils bash-completion locales * Add a new user in the chroot $ adduser user * Add your new user to sudo group $ adduser user sudo * Fix sudo error with visudo: $ visudo %sudo ALL=(ALL:ALL) NOPASSWD:ALL * From now on, use your new user for the following steps: $ su user * Follow guide for ROS Melodic from ROS: [[http://wiki.ros.org/melodic/Installation/Ubuntu]] * Follow guide for ROS Dashing from ROS: [[https://index.ros.org/doc/ros2/Installation/Dashing/Linux-Install-Debians/]] ===== Creating ROS Melodic Workspace ===== Since ROS Hydro (ROS 1), ROS use [[wiki.ros.org/catkin/workspaces|Catkin]] for building all packages. The following links shows the basic steps for creating a Catkin Workspace. * [[http://wiki.ros.org/catkin/Tutorials/create_a_workspace|Create a workspace]] After creating the workspace, build a basic package for testing purposes. * [[http://wiki.ros.org/catkin/Tutorials/CreatingPackage|Create a ROS package]] * [[http://wiki.ros.org/ROS/Tutorials/WritingPublisherSubscriber%28python%29|Writing a simple node in Python]] * [[http://wiki.ros.org/ROS/Tutorials/ExaminingPublisherSubscriber|Running the simple node]] ===== Creating ROS Dashing Workspace ===== Since ROS Crystal (ROS 2) to newer versions, ROS use [[https://colcon.readthedocs.io/en/released/|Colcon]] for building all packages. This guide shows the basic steps for creating a Colcon Workspace. * Source ROS 2 configuration $ source /opt/ros/dashing/setup.bash * Install colcon $ sudo apt install python3-colcon-common-extensions * Create workspace for ROS 2 $ mkdir -p ~/ros2_ws/src * Move to the new workspace and build it $ cd ~/ros2_ws $ colcon build * Source workspace configuration $ source ~/ros2_ws/install/local_setup.bash && source ~/ros2_ws/install/setup.bash After creating the workspace, lets build some examples packages for ROS 2. * Clone ROS 2 examples package repository in our workspace $ cd ~/ros2_ws/src $ git clone git clone https://github.com/ros2/examples $ git checkout $ROS_DISTRO * Build examples package $ cd ~/ros2_ws $ colcon build --symlink-install * Test builded package. Remember to run each command on different terminals and source ROS 2 configuration on each terminal. $ ros2 run examples_rclcpp_minimal_subscriber subscriber_member_function $ ros2 run examples_rclcpp_minimal_publisher publisher_member_function