Skip to content

Instantly share code, notes, and snippets.

@mrfoxie
Created May 15, 2021 08:38
Show Gist options
  • Save mrfoxie/29f01df7f0de04172bce32117941f05a to your computer and use it in GitHub Desktop.
Save mrfoxie/29f01df7f0de04172bce32117941f05a to your computer and use it in GitHub Desktop.
ROS System tutorials online on colab as well as you can setup on Ubuntu 18.04.5 bionic version.
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "ROS System.ipynb",
"provenance": [],
"collapsed_sections": [],
"toc_visible": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "g5V-UpA2nBeE"
},
"source": [
"# Let's update and upgrade system"
]
},
{
"cell_type": "code",
"metadata": {
"id": "VVt9r4fJnFes"
},
"source": [
"!apt update\n",
"!apt upgrade -y"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "um6hvy1AnM4q"
},
"source": [
"# Check which system for installation for ROS Systen"
]
},
{
"cell_type": "code",
"metadata": {
"id": "rVtpRP5QnlA2"
},
"source": [
"!lsb_release -a\n",
"!uname -a"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "ELBjZZc_n7Hi"
},
"source": [
"# Now let's update sources.list"
]
},
{
"cell_type": "code",
"metadata": {
"id": "8X3LiwJpoF4z"
},
"source": [
"!sh -c 'echo \"deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main\" > /etc/apt/sources.list.d/ros-latest.list'\n",
"!apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "h0eC6u9docty"
},
"source": [
"# As the `ROS System` is been added to our systen so now let's update our repositories to get all resources from ROS"
]
},
{
"cell_type": "code",
"metadata": {
"id": "mIF9U77GpihR"
},
"source": [
"!apt update"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "c0acyT_BpkzH"
},
"source": [
"# Now as we have done all the process and check what our system(Ubuntu 18.04.5 bionic) is, so now lets check ros packages which we fetch from ROS System."
]
},
{
"cell_type": "code",
"metadata": {
"id": "fhPZIIZAqNN8"
},
"source": [
"!apt search ros-melodic-desktop-full"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "sPy9Nc-9qSia"
},
"source": [
"# As we successfully fetch from ROS System and also check that the package is been fetched so lets install it in our system."
]
},
{
"cell_type": "code",
"metadata": {
"id": "9Jf7g6sGqnLN"
},
"source": [
"!apt install ros-melodic-desktop-full -y"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "yT2hyMT6te1V"
},
"source": [
"# Now let's update our bash so that we can use ROS command anytime we want."
]
},
{
"cell_type": "code",
"metadata": {
"id": "KprcQMRstp1R"
},
"source": [
"!echo \"source /opt/ros/melodic/setup.bash\" >> ~/.bashrc\n",
"!source ~/.bashrc\n",
"!source /opt/ros/melodic/setup.bash"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "iMh8CVsWt-t6"
},
"source": [
"# Some of the dependancy are been not installed while installation of ROS System so for our safe side let's install it on our system"
]
},
{
"cell_type": "code",
"metadata": {
"id": "paZdZd7FuO01"
},
"source": [
"apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential -y"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "eVkCgdXhuUAv"
},
"source": [
"# After all the installation and all the process we will initialize rosdep to get all the sources from ROS"
]
},
{
"cell_type": "code",
"metadata": {
"id": "od5UUPTnukxE"
},
"source": [
"!sudo rosdep init"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "n_T2V_aFuu1i"
},
"source": [
"# Now update ROS packages"
]
},
{
"cell_type": "code",
"metadata": {
"id": "R9u1V6nZuuON"
},
"source": [
"!rosdep update"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "H3MSfI1mu5av"
},
"source": [
"# Workshop setup using existing workshop\n",
"Till now we have update our package and installing the ROS pacakge by checking our System in the starting. Now we well see some commands which will help to you to understand how to use ros command and run your first program \n",
"I have also make an git repo on github and i will be also uploading it on gitlab also \n",
"``` bash\n",
"git clone https://github.com/mrfoxie/ros_tutorials.git\n",
"```\n",
"the above code is the ros project which will help you to understand the workflow of ros system as well as to create your first own turtle simulator. so we will be cloning it here so that we can check it our how does it works or you can skip this step and create workshop mannually."
]
},
{
"cell_type": "code",
"metadata": {
"id": "L93F0AaOwpyE"
},
"source": [
"!cd ~/\n",
"!pwd\n",
"!git clone https://github.com/mrfoxie/ros_tutorials.git catkin_ws\n",
"!cd catkin_ws"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "cigmdr3-5Nab"
},
"source": [
"# If you want to use ROS command and make workshop then use the following command but first we have to check ROS environment and see all the details, and setup the setup.sh file in the system."
]
},
{
"cell_type": "code",
"metadata": {
"id": "C-jzZtCP5NDk"
},
"source": [
"!printenv | grep ROS\n",
"!source /opt/ros/melodic/setup.bash"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "Drb6XMk25m5t"
},
"source": [
"# let's create workshop mannually"
]
},
{
"cell_type": "code",
"metadata": {
"id": "tl6rbx4g7KLN"
},
"source": [
"!mkdir -p ~/catkin_ws/src\n",
"!cd ~/carkin_ws"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "Z1NsruMF7eYU"
},
"source": [
"# Initializing Project\n",
"as we have create workshop now we will initialze the project "
]
},
{
"cell_type": "code",
"metadata": {
"id": "1yC0j3jYD1GX"
},
"source": [
"!cd ~/catkin_ws\n",
"!pwd\n",
"!catkin_make"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "MaNl6RDUD8Vo"
},
"source": [
"Now as we initialze the project there will be some directory will be created in `catkin_ws` folder will be created such as `build` and `devel`. After the process is done we will use setup.bash to execute `devel/setup.bash` to build packages."
]
},
{
"cell_type": "code",
"metadata": {
"id": "Q5yA4xljHEHD"
},
"source": [
"!source ~/catkin_ws/devel/setup.bash"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "CxSHZisvH2W6"
},
"source": [
"# Path Checking\n",
"After building setup.bash lets check the path of our directory using ROS Package Path."
]
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "yq5LMm5fIHJc",
"outputId": "1c740ccd-a068-4c97-b1e4-9e7035d04eb6"
},
"source": [
"!cd ~/catkin_ws\n",
"!echo $ROS_PACKAGE_PATH"
],
"execution_count": 4,
"outputs": [
{
"output_type": "stream",
"text": [
"/bin/bash: line 0: cd: /root/catkin_ws: No such file or directory\n",
"\n"
],
"name": "stdout"
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment