# ROS ## ROS ### Install [ROS Melodic Morenia](http://wiki.ros.org/melodic/Installation/Ubuntu) in Ubuntu 18.04 LTS (Bionic Beaver) ```bash # setup your sources.list sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' # set up your keys curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - # installation sudo apt update sudo apt install ros-melodic-desktop-full # environment setup for bash echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc source ~/.bashrc # environment setup for zsh echo "source /opt/ros/melodic/setup.zsh" >> ~/.zshrc source ~/.zshrc # dependencies for building packages sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential # initialize rosdep sudo rosdep init rosdep update ``` ### Command Cheat Sheet -`rqt_graph` --- ## ROS 2 ### Install ROS 2 Galactic Geochelone - Offical [building guide](https://docs.ros.org/en/galactic/Installation/Ubuntu-Development-Setup.html#building-ros-2-on-ubuntu-linux) is for Ubuntu 20.04 - The following building step is tested on Ubuntu 18.04 #### Building ROS 2 on Ubuntu 18.04 ```bash= # Add the ROS 2 apt repository sudo apt install software-properties-common sudo add-apt-repository universe sudo apt update && sudo apt install curl gnupg lsb-release sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null # Install development tools and ROS tools sudo apt update && sudo apt install -y \ build-essential \ cmake \ git \ python3-colcon-common-extensions \ python3-flake8 \ python3-pip \ python3-pytest-cov \ python3-rosdep \ python3-setuptools \ python3-vcstool \ wget # install some pip packages needed for testing python3 -m pip install -U \ flake8-blind-except \ flake8-builtins \ flake8-class-newline \ flake8-comprehensions \ flake8-deprecated \ flake8-docstrings \ flake8-import-order \ flake8-quotes \ pytest-repeat \ pytest-rerunfailures \ pytest \ setuptools # Install dependencies fot Ubuntu 18.04 python3 -m pip install -U importlib-metadata importlib-resources # Get ROS 2 code mkdir -p ~/ros2_galactic/src cd ~/ros2_galactic wget https://raw.githubusercontent.com/ros2/ros2/galactic/ros2.repos vcs import src < ros2.repos # Install dependencies using rosdep sudo rosdep init rosdep update rosdep install --from-paths src --ignore-src --rosdistro galactic -y --skip-keys "console_bridge fastcdr fastrtps rti-connext-dds-5.3.1 urdfdom_headers" # Build the code in the workspace cd ~/ros2_galactic/ colcon build --symlink-install ``` ##### Environment setup ```bash= # Source the setup script . ~/ros2_galactic/install/local_setup.bash ``` ##### Examples ```bash= # In one terminal . ~/ros2_galactic/install/local_setup.bash ros2 run demo_nodes_cpp talker ``` ```bash= # In another terminal . ~/ros2_galactic/install/local_setup.bash ros2 run demo_nodes_py listener ``` ### Command Cheat Sheet - `ros2 topic info /turtle1/cmd_vel` - `ros2 topic echo /scan` - `ros2 service list -t` - `ros2 node list` - `colcon build --packages-select flip_laser` - `ros2 param list` ### RCLPY #### Logging - https://github.com/ros2/examples/blob/669ec3e6807a0b2620a01b26513e713e8a9a14f0/rclpy/services/minimal_client/examples_rclpy_minimal_client/client.py#L35 --- ## Gazebo - Run Gazebo in VMware `export SVGA_VGPU10=0` `echo "export SVGA_VGPU10=0" >> ~/.bashrc` https://answers.gazebosim.org//question/13214/virtual-machine-not-launching-gazebo/ - [Aerodynamics](http://gazebosim.org/tutorials?tut=aerodynamics&cat=physics) ## Reference - https://varhowto.com/install-ros-noetic-raspberry-pi-4/