Skip to content

Commit

Permalink
Jammy develop (#59)
Browse files Browse the repository at this point in the history
* updating the robot setup tools

* updating autostart scripts

* installing the corresponding moveit packages as well

* fixing cyclone dds install

* fixes

* add extra spaces

* minor space fix

* some more updates

* add the missing rosdep command

* update rosdep init with a continuation condition

* adding script for installing packages for client PC

* fixing indentation

* updates to the client setup script

* neo_nav2_bringup is a binary now

* update abort

* setting up ROX simulation from the script

* adding cyclonedds installation
  • Loading branch information
padhupradheep authored Nov 8, 2024
1 parent 5520ce9 commit 8cafbcc
Show file tree
Hide file tree
Showing 8 changed files with 525 additions and 28 deletions.
147 changes: 147 additions & 0 deletions package-setup/setup-client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
#!/bin/bash

# exit if any command below fails
set -e
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[0;33m'
WHITE='\033[0;37m'

echo "Welcome to the support assistant for setting up the client PC Neobotix packages"
echo "The workspace will be created in the /home/USER/ folder. In the future, we will add the option, to create the workspace in any desired directory"

# Check if the client ws is already there in the home folder
cd ~/
is_ws_installed=""

if [ -d "client_nbx_ws" ]; then
echo "client_nbx_ws already exists."
echo -n "Do you want to delete it before continuing? (Y/n)"
read is_ws_installed

if [[ "$is_ws_installed" == "y" || "$is_ws_installed" == "Y" ]]; then
echo -e " Deleting.."
rm -rf "client_nbx_ws"
echo -e " client_nbx_ws has been deleted"
else
echo "Abort"
exit 0
fi
fi

# Check if ROS is sourced
empty_ros_distro=true
ros_distros=" "
if [ "$ROS_DISTRO" == "" ]; then
echo "ROS Distro is not sourced."
for dir in /opt/ros/*/; do
if [ "$(ls -A "$dir")" ]; then
empty_ros_distro=false
echo -e "$GREEN"
echo " " $(basename "$dir")
fi
done

if [ $empty_ros_distro == true ]; then
echo "ROS 2 is not installed at all"
echo "Please continue the installation once ROS 2 is installed"
echo "Abort"
else
echo -e "${RED} Please source any one of the ROS Distros above and try again later"
echo -e "${RED} Example: source /opt/ros/YOUR_DISTRO/setup.bash"
echo "Abort"
exit 0
fi
fi

uni_ans=""
robot_model=""

# Go to home directory
cd ~

echo "Creating a client_nbx workspace"

mkdir -p client_nbx_ws/src
cd client_nbx_ws/src

while [[ "$robot_model" != "mp_400" &&
"$robot_model" != "mp_500" &&
"$robot_model" != "mpo_500" &&
"$robot_model" != "mpo_700" &&
"$robot_model" != "rox" ]]; do
echo -e -n "${GREEN} Choose your robot (mp_400/mp_500/mpo_500/mpo_700/rox):"

read robot_model

echo -e "${WHITE}"

if [ "$robot_model" == "rox" ]; then
git clone --branch $ROS_DISTRO https://github.com/neobotix/rox.git
elif [[ "$robot_model" == "mp_400" || "$robot_model" == "mp_500" || "$robot_model" == "mpo_500" || "$robot_model" == "mpo_700" ]]; then
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_$robot_model-2.git
else
echo -e "${RED} Please select a valid option"
fi
done

echo "Performing rosdep initialization and update"
sudo rosdep init || { true; echo -e "${YELLOW} rosdep init is not required"; }
rosdep update

# Install build tool
echo "Installing colcon extensions"
sudo apt install python3-colcon-common-extensions

# Installing CycloneDDS
echo "Installing CycloneDDS"
sudo apt install ros-$ROS_DISTRO-cyclonedds

#Install xterm - useful when
sudo apt install xterm

git clone --branch master https://github.com/neobotix/neo_msgs2
git clone --branch master https://github.com/neobotix/neo_srvs2

cd ~/client_nbx_ws

# Install relevant dependencies
rosdep install --from-paths ./src/rox/rox_navigation/ ./src/rox/rox_description --ignore-src --rosdistro $ROS_DISTRO -r -y || { true; echo -e "${YELLOW} Finishing the setup"; }

cd ~/client_nbx_ws/src

if [[ "$robot_model" == "mpo_500" || "$robot_model" == "mpo_700" || "$robot_model" == "rox" ]]; then
while [[ "$uni_ans" != "y" && "$uni_ans" != "n" ]]; do
echo -e "${GREEN} Universal robots ? (y/n)"
read uni_ans

if [ "$uni_ans" == "y" ]; then
if [[ "$robot_model" == "mpo_500" || "$robot_model" == "mpo_700" ]]; then
git clone --branch main https://github.com/neobotix/neo_mpo_moveit2.git
rosdep install --from-paths ./neo_mpo_moveit2 --ignore-src --rosdistro $ROS_DISTRO -r -y || { true; echo -e "${YELLOW} Finishing the setup"; }
elif [ "$robot_model" == "rox" ]; then
git clone --branch main https://github.com/neobotix/neo_rox_moveit2.git
rosdep install --from-paths ./neo_rox_moveit2 --ignore-src --rosdistro $ROS_DISTRO -r -y || { true; echo -e "${YELLOW} Finishing the setup"; }
else
uni_ans = "n"
fi
fi
done
fi

cd ~/client_nbx_ws

echo -e "${WHITE}"

# build workspace
colcon build --symlink-install

echo "source ~/client_nbx_ws/install/setup.bash" >> ~/.bashrc

echo "Setting CycloneDDS as the Middleware"

echo "export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp" >> ~/.bashrc

echo "Installation successful !!!"

exit 0
164 changes: 164 additions & 0 deletions package-setup/setup-mp-robot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
#!/bin/bash

# exit if any command below fails
set -e

# create folders
mkdir -p ~/.config/autostart/

# copy files
cp ../generic/ROS-Neobotix-Autostart.desktop ~/.config/autostart/
cp ../generic/startROS.desktop ~/Desktop/

# Check if ROS is sourced

if [ "$ROS_DISTRO" == "" ];
then
echo "Installation cannot continue. No ROS sourced, please check if ROS is installed and sourced. Please try again after that!"
exit 0
fi

echo "Welcome to the setup of your MP robot, please select the dependencies that are required for your robot"

uni_ans=""
phi_ans=""
realsense_ans=""
skip_depend=""
arm_type=" "
use_imu="False"
use_d435="False"

while [[ "$robot_model" != "mp_400" && "$robot_model" != "mp_500" && "$robot_model" != "mpo_500" && "$robot_model" != "mpo_700" ]]; do
echo "Choose your robot (mp_400/mp_500/mpo_500/mpo_700)"
read robot_model
if [[ "$robot_model" == "mp_400" || "$robot_model" == "mp_500" ]]; then
echo "neo_kinematics_differential2 package will be cloned"
elif [ "$robot_model" == "mpo_500" ]; then
echo "neo_kinematics_mecanum2 package will be cloned"
elif [ "$robot_model" == "mpo_700" ]; then
echo "neo_kinematics_omnidrive2 package will be cloned"
else
echo "Wrong option - Please try again"
fi
done

if [[ "$robot_model" == "mpo_500" || "$robot_model" == "mpo_700" ]]; then
while [[ "$uni_ans" != "y" && "$uni_ans" != "n" ]]; do
echo "Universal robots ? (y/n)"
read uni_ans
if [ "$uni_ans" == "n" ]; then
skip_depend+="ur_client_library ur_msgs ur_description ur_robot_driver "
elif [ "$uni_ans" == "y" ]; then
echo "Universal robots dependencies will be installed and added to autstart"
while [[ "$arm_type" != "ur10" && "$arm_type" != "ur10e" && "$arm_type" != "ur5" && "$arm_type" != "ur5e" ]]; do
echo "arm_type? (ur10/ur10e/ur5/ur5e)"
read arm_type
done
else
echo "Wrong option - Please try again"
fi
done
fi

while [[ "$phi_ans" != "y" && "$phi_ans" != "n" ]]; do
echo "Phidget IMU ? (y/n)"
read phi_ans
if [ "$phi_ans" == "n" ]; then
skip_depend+="phidgets-drivers"
use_imu="False"
elif [ "$phi_ans" == "y" ]; then
echo "Phidget IMU dependencies will be installed and added to autstart"
use_imu="True"
else
echo "Wrong option - Please try again"
fi
done

while [[ "$realsense_ans" != "y" && "$realsense_ans" != "n" ]]; do
echo "Realsense Camera (URDF only supports D435i) ? (y/n)"
read realsense_ans
if [ "$realsense_ans" == "n" ]; then
skip_depend+="realsense2_camera realsense2_camera_msgs realsense2_description"
use_d435="False"
elif [ "$realsense_ans" == "y" ]; then
echo "Realsense camera dependencies will be installed and added to autstart"
use_d435="True"
else
echo "Wrong option - Please try again"
fi
done

echo "Performing rosdep initialization and update"
sudo rosdep init || { true; echo -e "${YELLOW} rosdep init is not required"; }
rosdep update

# Install build tool
echo "Installing colcon extensions"
sudo apt install python3-colcon-common-extensions

# Installing CycloneDDS
echo "Installing CycloneDDS"
sudo apt install ros-$ROS_DISTRO-cyclonedds

#Install xterm - useful when
sudo apt install xterm

cd ~

mkdir -p ros2_workspace/src
cd ros2_workspace/src

# clone git repos here...
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_$robot_model-2.git
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_local_planner2.git
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_localization2.git
git clone --branch master https://github.com/neobotix/neo_common2
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_relayboard_v2-2
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_sick_s300-2
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_teleop2
git clone --branch master https://github.com/neobotix/neo_msgs2
git clone --branch master https://github.com/neobotix/neo_srvs2
git clone https://github.com/neobotix/joystick_drivers.git

if [[ "$robot_model" == "mp_400" || "$robot_model" == "mp_500" ]]; then
git clone --branch main https://github.com/neobotix/neo_kinematics_differential2.git
elif [ "$robot_model" == "mpo_500" ]; then
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_kinematics_mecanum2.git
elif [ "$robot_model" == "mpo_700" ]; then
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_kinematics_omnidrive2.git
fi

if [ "$uni_ans" == "y" ]; then
git clone --branch main https://github.com/neobotix/neo_mpo_moveit2.git
fi

# build workspace
cd ..

echo "Installing dependencies, skipping the following" $skip_depend
# Install relevant dependencies
rosdep install --from-paths ./src --ignore-src --rosdistro $ROS_DISTRO -r -y --skip-keys "$skip_depend"

colcon build --symlink-install

echo "export LC_NUMERIC="en_US.UTF-8" " >> ~/.bashrc

echo "source ~/ros2_workspace/install/setup.bash" >> ~/.bashrc

echo "export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp" >> ~/.bashrc

echo "Setting up startup scripts"

echo "source ~/ros2_workspace/install/setup.bash" >> ROS_AUTOSTART.sh

echo "sleep 2" >> ROS_AUTOSTART.sh

echo "ros2 launch neo_"$robot_model"-2 bringup.launch.py arm_type:="$arm_type" use_imu:="$use_imu" use_d435:="$use_d435>> ROS_AUTOSTART.sh

chmod +x ROS_AUTOSTART.sh

mv ROS_AUTOSTART.sh ~/

echo "Installation successful !!!"

exit 0
1 change: 0 additions & 1 deletion package-setup/setup-mp_400.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ cd mp_400_workspace/src

# clone git repos here...
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_mp_400-2.git
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_nav2_bringup.git
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_local_planner2.git
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_localization2.git
git clone --branch master https://github.com/neobotix/neo_common2
Expand Down
1 change: 0 additions & 1 deletion package-setup/setup-mp_500.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ cd mp_500_workspace/src

# clone git repos here...
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_mp_500-2.git
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_nav2_bringup.git
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_local_planner2.git
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_localization2.git
git clone --branch master https://github.com/neobotix/neo_common2
Expand Down
1 change: 0 additions & 1 deletion package-setup/setup-mpo_500.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ cd mpo_500_workspace/src

# clone git repos here...
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_mpo_500-2.git
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_nav2_bringup.git
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_local_planner2.git
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_localization2.git
git clone --branch master https://github.com/neobotix/neo_common2
Expand Down
1 change: 0 additions & 1 deletion package-setup/setup-mpo_700.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ cd mpo_700_workspace/src

# clone git repos here...
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_mpo_700-2.git
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_nav2_bringup.git
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_local_planner2.git
git clone --branch $ROS_DISTRO https://github.com/neobotix/neo_localization2.git
git clone --branch master https://github.com/neobotix/neo_common2
Expand Down
Loading

0 comments on commit 8cafbcc

Please sign in to comment.