Skip to content

Instantly share code, notes, and snippets.

@bugparty
Last active May 22, 2024 05:41
Show Gist options
  • Save bugparty/c9c94a6187f469a8305b11998e320d08 to your computer and use it in GitHub Desktop.
Save bugparty/c9c94a6187f469a8305b11998e320d08 to your computer and use it in GitHub Desktop.
install ros1 and kobuki
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
# Function to install ROS Noetic
install_ros() {
echo "Setting up sources.list for ROS Noetic"
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
echo "Setting up keys for ROS Noetic"
sudo apt install -y curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
echo "Updating package index"
sudo apt-get update
echo "Installing ROS Noetic desktop full"
sudo apt-get install -y ros-noetic-desktop-full
echo "Installing additional ROS packages"
sudo apt-get install -y ros-noetic-jackal-gazebo
echo "Setting up ROS environment"
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
echo "Installing additional ROS dependencies"
sudo apt install -y python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
echo "Initializing rosdep"
sudo apt install -y python3-rosdep
sudo rosdep init
rosdep update
echo "ROS Noetic installation completed successfully!"
}
# Function to install Kobuki base
install_kobuki() {
echo "Installing ROS Noetic Kobuki core packages"
sudo apt-get install -y ros-noetic-kobuki-core
echo "Installing additional dependencies for Kobuki"
sudo apt install -y liborocos-kdl-dev
sudo apt-get install -y ros-noetic-ecl-*
sudo apt-get install -y libusb-dev
sudo apt-get install -y libftdi-dev
echo "Setting up catkin workspace and cloning repositories for Kobuki"
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/src
git clone https://github.com/yujinrobot/kobuki.git
git clone https://github.com/yujinrobot/yujin_ocs.git
git clone https://github.com/yujinrobot/kobuki_msgs.git
git clone https://github.com/yujinrobot/kobuki_core.git
echo "Modifying yujin_ocs directory"
cd yujin_ocs
mkdir save
mv yocs_cmd_vel_mux save
mv yocs_controllers save
mv yocs_velocity_smoother save
rm -rf yocs*
cd save
mv * ..
cd .. && rmdir save
echo "Sourcing ~/.bashrc again to ensure ROS environment is set up"
source ~/.bashrc
echo "Building the catkin workspace"
cd ~/catkin_ws/
catkin_make
echo "Cloning kobuki_desktop repository and removing kobuki_qtestsuite"
cd ~/catkin_ws/src
git clone https://github.com/yujinrobot/kobuki_desktop.git
cd kobuki_desktop/
rm -r kobuki_qtestsuite
echo "Building the catkin workspace again"
cd ~/catkin_ws
catkin_make # or catkin build, depending on your setup
echo "Sourcing ~/.bashrc again to finalize the setup"
source ~/.bashrc
echo "Kobuki installation completed successfully!"
}
# Ask the user if they want to install Kobuki base
read -p "Do you want to install Kobuki base? (y/n): " install_kobuki_choice
# Install ROS Noetic
install_ros
# Source .bashrc to ensure ROS environment is set up
source ~/.bashrc
# Install Kobuki base if the user chose to do so
if [[ $install_kobuki_choice == "y" || $install_kobuki_choice == "Y" ]]; then
install_kobuki
else
echo "Kobuki installation skipped."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment