diff --git a/README.md b/README.md index 8d399d94..938849d9 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/docker/Dockerfile b/docker/Dockerfile index 08b2cd6d..fbee90cb 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -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 diff --git a/rosbot/install_dependencies.sh b/rosbot/install_dependencies.sh new file mode 100755 index 00000000..3f364c12 --- /dev/null +++ b/rosbot/install_dependencies.sh @@ -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 diff --git a/rosbot/rosbot_hardware.repos b/rosbot/rosbot_hardware.repos index 8b7459b1..fe402a5f 100644 --- a/rosbot/rosbot_hardware.repos +++ b/rosbot/rosbot_hardware.repos @@ -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 diff --git a/rosbot_controller/package.xml b/rosbot_controller/package.xml index 31f93620..a0e82f6c 100644 --- a/rosbot_controller/package.xml +++ b/rosbot_controller/package.xml @@ -1,9 +1,9 @@ - rosbot_gazebo + rosbot_controller 0.13.2 - Gazebo Ignition simulation for ROSbot 2, 2R, PRO + Hardware configuration for ROSbot 2, 2R, PRO Husarion @@ -13,27 +13,37 @@ https://github.com/husarion/rosbot_ros https://github.com/husarion/rosbot_ros/issues - Krzysztof Wojciechowski Jakub Delicat - Rafal Gorecki - - rosbot_bringup - launch - launch_ros - husarion_gz_worlds - ros_gz_sim - ros_gz_bridge - ign_ros2_control - nav2_common - - python3-pytest - launch - launch_ros - launch_pytest - tf_transformations - python-transforms3d-pip - nav_msgs - geometry_msgs + + ament_cmake + + launch + launch_ros + xacro + controller_manager + robot_state_publisher + rosbot_description + ros_components_description + rosbot_hardware_interfaces + joint_state_broadcaster + imu_sensor_broadcaster + diff_drive_controller + mecanum_drive_controller + + python3-pytest + launch + launch_ros + launch_pytest + xacro + sensor_msgs + nav_msgs + rosbot_description + ros_components_description + controller_manager + joint_state_broadcaster + imu_sensor_broadcaster + diff_drive_controller + mecanum_drive_controller ament_python diff --git a/rosbot_gazebo/package.xml b/rosbot_gazebo/package.xml index 5c7a01a9..31f93620 100644 --- a/rosbot_gazebo/package.xml +++ b/rosbot_gazebo/package.xml @@ -17,29 +17,23 @@ Jakub Delicat Rafal Gorecki - rosbot_bringup - - launch - launch_ros - - husarion_gz_worlds - ros_gz_sim - - ros_gz_bridge - ign_ros2_control - nav2_common - - python3-pytest - launch - launch_ros - launch_pytest - - tf_transformations - python-transforms3d-pip - nav_msgs - geometry_msgs + rosbot_bringup + launch + launch_ros + husarion_gz_worlds + ros_gz_sim + ros_gz_bridge + ign_ros2_control + nav2_common + + python3-pytest + launch + launch_ros + launch_pytest + tf_transformations + python-transforms3d-pip + nav_msgs + geometry_msgs ament_python