Skip to content

Instantly share code, notes, and snippets.

@surajRathi
Last active October 15, 2022 05:47
Show Gist options
  • Save surajRathi/eb587d2ce9d61e7217d846168c370a85 to your computer and use it in GitHub Desktop.
Save surajRathi/eb587d2ce9d61e7217d846168c370a85 to your computer and use it in GitHub Desktop.
#! /usr/bin/bash
# Installing ROS
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt install curl -y # if you haven't already installed curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo apt update -y
sudo apt install ros-noetic-desktop-full
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
# sudo touch /etc/udev/rules.d/98-abhiyaan-arduino.rules
cat - << EOF | sudo tee /etc/udev/rules.d/98-abhiyaan-arduino.rules
KERNEL=="tty*" SUBSYSTEMS=="usb" ATTRS{devpath}=="1.1" SYMLINK+="usb1"
KERNEL=="tty*" SUBSYSTEMS=="usb" ATTRS{devpath}=="1.2" SYMLINK+="usb2"
KERNEL=="tty*" SUBSYSTEMS=="usb" ATTRS{devpath}=="1.3" SYMLINK+="usb3"
KERNEL=="tty*" SUBSYSTEMS=="usb" ATTRS{devpath}=="1.4" SYMLINK+="usb4"
EOF
sudo udevadm control --reload
sudo udevadm trigger
sudo apt install python-is-python3 python3-pip -y
# Note, pip will build multiple packages
# Maybe use MAKEFLAGS="-j3" to speed it up
python -m pip install wiringpi numpy pandas readchar datetime serial
# We dont need pandas and wiringpi for rpi 2, they take a huge amount of time to install
# Use sudo apt install python3-pandas
sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential -y
sudo rosdep init
rosdep update
# Adding authorized key from client's .ssh/id_rsa.pub to host's .ssh/authorized_keys
# I.e. put rpi1's keys on rpi 2
cat - << 'EOF' >> ~/.bashrc
export ROS_HOSTNAME=$(hostname -I | head -c -2 -)
export ROS_MASTER_URI=http://$ROS_HOSTNAME:11311
export EDITOR='nano -w'
clear
echo "Entered"
EOF
python3 -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
echo "export PATH=$PATH:$HOME/.platformio/penv/bin" >> ~/.profile
curl 'https://github.com/platformio/platformio-core/blob/develop/scripts/99-platformio-udev.rules' | sudo tee /etc/udev/rules.d/99-platformio-udev.rules
sudo udevadm control --reload
sudo udevadm trigger
sudo usermod -a -G dialout $USER
# Libraries specific to AtmelAVR and Xpressif for Arduino and ESP32 must be installed in platformio
# Note: This can be automatically done by running "pio run" for the platformio codes themselves
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment