Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tools: Add ardupilot_gazebo install script #22598

Merged
merged 2 commits into from
Jan 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Tools/environment_install/install-ROS-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -e
# set -x

ROS_WS_ROOT=$HOME/ardupilot-ws
AP_GZ_ROOT=$HOME/ardupilot_gazebo

red=`tput setaf 1`
green=`tput setaf 2`
Expand Down Expand Up @@ -246,6 +247,27 @@ else
echo "Skipping adding ardupilot_ws to your home folder."
fi


if maybe_prompt_user "Add ardupilot_gazebo to your home folder [N/y]?" ; then
if [ ! -d $AP_GZ_ROOT ]; then
sudo apt install libgz-sim7-dev rapidjson-dev
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sudo apt install gz-garden rapidjson-dev is needed to install all the libraries. See https://gazebosim.org/docs/garden/install_ubuntu.

git clone https://github.com/ArduPilot/ardupilot_gazebo
pushd $AP_GZ_ROOT
mkdir build && pushd build
Copy link
Contributor

@srmainwaring srmainwaring Jan 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to create the workspace directory first, then clone, then cd into the project, then make build dir and build.

mkdir -p $AP_GZ_ROOT/src
pushd $AP_GZ_ROOT/src
git clone https://github.com/ArduPilot/ardupilot_gazebo
pushd ardupilot_gazebo
mkdir build && pushd build

Suggest that AP_GZ_ROOT has value ardupilot_gz_ws to distinguish from the project. Also, we should clone into $AP_GZ_ROOT/src so we can switch to using colcon for the build and install which is consistent with how Gazebo Sim and ROS2 are built (ardupilot_gazebo docs need to be updated to use this approach as well).

cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j4
popd
popd
echo 'export GZ_SIM_SYSTEM_PLUGIN_PATH=$AP_GZ_ROOT/build:${GZ_SIM_SYSTEM_PLUGIN_PATH}' >> ~/.bashrc
echo 'export GZ_SIM_RESOURCE_PATH=$AP_GZ_ROOT/models:$AP_GZ_ROOT/worlds:${GZ_SIM_RESOURCE_PATH}' >> ~/.bashrc
else
heading "${red}ardupilot_gazebo already exists, skipping...${reset}"
fi

else
echo "Skipping adding ardupilot_gazebo to your home folder."
fi

heading "${green}Adding setup.bash, ROS_MASTER_URI and ROS_HOSTNAME to .bashrc ${reset}"
grep -q -F "source $ROS_WS_ROOT/devel/setup.bash" ~/.bashrc || echo "source $ROS_WS_ROOT/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
Expand Down