Skip to content

Commit

Permalink
Add install dependencies script
Browse files Browse the repository at this point in the history
  • Loading branch information
rafal-gorecki committed Dec 2, 2024
1 parent 97f096f commit 0fbf80f
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 64 deletions.
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,7 @@ Available in [ROS_API.md](./ROS_API.md)
2. Install dependencies:

``` bash
vcs import src < src/rosbot_ros/rosbot/rosbot_$HUSARION_ROS_BUILD_TYPE.repos
cp -r src/ros2_controllers/imu_sensor_broadcaster src
rm -rf src/ros2_controllers
sudo rosdep init
rosdep update --rosdistro $ROS_DISTRO
rosdep install --from-paths src -y -i
./src/rosbot_ros/rosbot/install_dependencies.sh
```

3. Build:
Expand Down
9 changes: 1 addition & 8 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,7 @@ RUN apt-get update && apt-get install -y \
stm32flash \
ros-${ROS_DISTRO}-teleop-twist-keyboard && \
# Setup workspace
vcs import src < src/rosbot_ros/rosbot/rosbot_$HUSARION_ROS_BUILD_TYPE.repos && \
cp -r src/ros2_controllers/imu_sensor_broadcaster src && \
rm -rf src/ros2_controllers && \
# Install dependencies
rosdep init && \
rosdep update --rosdistro $ROS_DISTRO && \
rosdep install --from-paths src -y -i && \
# Build
./src/rosbot_ros/rosbot/install_dependencies.sh && \
source /opt/ros/$ROS_DISTRO/setup.bash && \
colcon build --symlink-install --packages-up-to rosbot --cmake-args -DCMAKE_BUILD_TYPE=Release && \
# Get version
Expand Down
34 changes: 34 additions & 0 deletions rosbot/install_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

# Check if env HUSARION_ROS_BUILD_TYPE is set
if [ -z "$HUSARION_ROS_BUILD_TYPE" ]; then
echo "HUSARION_ROS_BUILD_TYPE is not set. Please set it to 'hardware' or 'simulation'"
exit 1
fi

# Define a function to run commands with or without sudo
run_with_sudo() {
if [ "$(id -u)" -ne 0 ]; then
sudo "$@"
else
"$@"
fi
}

# Install tools
run_with_sudo apt-get update
run_with_sudo apt-get install -y python3-pip ros-dev-tools stm32flash

# Import repositories
vcs import src < src/rosbot_ros/rosbot/rosbot_$HUSARION_ROS_BUILD_TYPE.repos
if [ "$HUSARION_ROS_BUILD_TYPE" == "simulation" ]; then
cp -r src/ros2_controllers/imu_sensor_broadcaster src
rm -rf src/ros2_controllers
fi

# Install dependencies
if ! [ -d /etc/ros/rosdep ]; then
run_with_sudo rosdep init
fi
rosdep update --rosdistro $ROS_DISTRO
rosdep install --from-paths src -y -i
4 changes: 0 additions & 4 deletions rosbot/rosbot_hardware.repos
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,3 @@ repositories:
type: git
url: https://github.com/husarion/rosbot_hardware_interfaces.git
version: da1805839aaa21b8341a9c39498c96d9a1a4f87d
ros2_controllers: # Bug: There is no nice way to change `sensor_name` imu_bradcaster param when spawning multiple robots -> ros2_control refer only to single imu entity
type: git
url: https://github.com/husarion/ros2_controllers/
version: 9da42a07a83bbf3faf5cad11793fff22f25068af
54 changes: 32 additions & 22 deletions rosbot_controller/package.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>rosbot_gazebo</name>
<name>rosbot_controller</name>
<version>0.13.2</version>
<description>Gazebo Ignition simulation for ROSbot 2, 2R, PRO</description>
<description>Hardware configuration for ROSbot 2, 2R, PRO</description>

<maintainer email="[email protected]">Husarion</maintainer>

Expand All @@ -13,27 +13,37 @@
<url type="repository">https://github.com/husarion/rosbot_ros</url>
<url type="bugtracker">https://github.com/husarion/rosbot_ros/issues</url>

<author email="[email protected]">Krzysztof Wojciechowski</author>
<author email="[email protected]">Jakub Delicat</author>
<author email="[email protected]">Rafal Gorecki</author>

<exec_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">rosbot_bringup</exec_depend>
<exec_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">launch</exec_depend>
<exec_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">launch_ros</exec_depend>
<exec_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">husarion_gz_worlds</exec_depend>
<exec_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">ros_gz_sim</exec_depend>
<exec_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">ros_gz_bridge</exec_depend>
<exec_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">ign_ros2_control</exec_depend>
<exec_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">nav2_common</exec_depend>

<test_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">python3-pytest</test_depend>
<test_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">launch</test_depend>
<test_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">launch_ros</test_depend>
<test_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">launch_pytest</test_depend>
<test_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">tf_transformations</test_depend>
<test_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">python-transforms3d-pip</test_depend>
<test_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">nav_msgs</test_depend>
<test_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">geometry_msgs</test_depend>

<buildtool_depend>ament_cmake</buildtool_depend>

<exec_depend>launch</exec_depend>
<exec_depend>launch_ros</exec_depend>
<exec_depend>xacro</exec_depend>
<exec_depend>controller_manager</exec_depend>
<exec_depend>robot_state_publisher</exec_depend>
<exec_depend>rosbot_description</exec_depend>
<exec_depend>ros_components_description</exec_depend>
<exec_depend condition="($HUSARION_ROS_BUILD_TYPE == hardware)">rosbot_hardware_interfaces</exec_depend>
<exec_depend>joint_state_broadcaster</exec_depend>
<exec_depend>imu_sensor_broadcaster</exec_depend>
<exec_depend>diff_drive_controller</exec_depend>
<exec_depend>mecanum_drive_controller</exec_depend>

<test_depend>python3-pytest</test_depend>
<test_depend>launch</test_depend>
<test_depend>launch_ros</test_depend>
<test_depend>launch_pytest</test_depend>
<test_depend>xacro</test_depend>
<test_depend>sensor_msgs</test_depend>
<test_depend>nav_msgs</test_depend>
<test_depend>rosbot_description</test_depend>
<test_depend>ros_components_description</test_depend>
<test_depend>controller_manager</test_depend>
<test_depend>joint_state_broadcaster</test_depend>
<test_depend>imu_sensor_broadcaster</test_depend>
<test_depend>diff_drive_controller</test_depend>
<test_depend>mecanum_drive_controller</test_depend>

<export>
<build_type>ament_python</build_type>
Expand Down
40 changes: 17 additions & 23 deletions rosbot_gazebo/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,23 @@
<author email="[email protected]">Jakub Delicat</author>
<author email="[email protected]">Rafal Gorecki</author>

<exec_depend>rosbot_bringup</exec_depend>

<exec_depend>launch</exec_depend>
<exec_depend>launch_ros</exec_depend>

<exec_depend>husarion_gz_worlds</exec_depend>
<exec_depend>ros_gz_sim</exec_depend>
<!-- Ignition dependency is specified in the ros_gz_sim package,
version can chosen using GZ_VERSION (or IGNITION_VERSION) env variable,
for details refer to the ros_gz_sim package -->
<exec_depend>ros_gz_bridge</exec_depend>
<exec_depend>ign_ros2_control</exec_depend>
<exec_depend>nav2_common</exec_depend>

<test_depend>python3-pytest</test_depend>
<test_depend>launch</test_depend>
<test_depend>launch_ros</test_depend>
<test_depend>launch_pytest</test_depend>

<test_depend>tf_transformations</test_depend>
<test_depend>python-transforms3d-pip</test_depend>
<test_depend>nav_msgs</test_depend>
<test_depend>geometry_msgs</test_depend>
<exec_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">rosbot_bringup</exec_depend>
<exec_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">launch</exec_depend>
<exec_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">launch_ros</exec_depend>
<exec_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">husarion_gz_worlds</exec_depend>
<exec_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">ros_gz_sim</exec_depend>
<exec_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">ros_gz_bridge</exec_depend>
<exec_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">ign_ros2_control</exec_depend>
<exec_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">nav2_common</exec_depend>

<test_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">python3-pytest</test_depend>
<test_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">launch</test_depend>
<test_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">launch_ros</test_depend>
<test_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">launch_pytest</test_depend>
<test_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">tf_transformations</test_depend>
<test_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">python-transforms3d-pip</test_depend>
<test_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">nav_msgs</test_depend>
<test_depend condition="($HUSARION_ROS_BUILD_TYPE == simulation)">geometry_msgs</test_depend>

<export>
<build_type>ament_python</build_type>
Expand Down

0 comments on commit 0fbf80f

Please sign in to comment.