From 1e064151ac1d0fe8537228a117a661987ace3965 Mon Sep 17 00:00:00 2001 From: Jakub Delicat Date: Thu, 29 Sep 2022 18:06:50 +0200 Subject: [PATCH] Added urdf --- Makefile | 2 +- compose.ros2aria.yaml | 8 +- src/pioneer_description/CMakeLists.txt | 30 ++ .../launch/pioneer_description.launch.py | 37 ++ src/pioneer_description/package.xml | 18 + src/pioneer_description/urdf/pioneer3dx.urdf | 367 ++++++++++++++++++ src/ros2aria/src/ros2aria.cpp | 2 +- 7 files changed, 460 insertions(+), 4 deletions(-) create mode 100644 src/pioneer_description/CMakeLists.txt create mode 100644 src/pioneer_description/launch/pioneer_description.launch.py create mode 100644 src/pioneer_description/package.xml create mode 100644 src/pioneer_description/urdf/pioneer3dx.urdf diff --git a/Makefile b/Makefile index 2230e5e..9da983f 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ build: build/ros2aria/ros2aria # .uploaded: build/ros2aria/ros2aria upload: - rsync -r . lab1_5@pionier6:~/ros2aria + rsync -r . lab1_5@pionier5:~/ros2aria touch .uploaded # upload: .uploaded diff --git a/compose.ros2aria.yaml b/compose.ros2aria.yaml index fb30dc2..98bfa94 100644 --- a/compose.ros2aria.yaml +++ b/compose.ros2aria.yaml @@ -1,5 +1,9 @@ -version: "3" +# docker compose -f compose.ros2aria.yaml up services: ros2aria: build: . - command: ros2 run ros2aria ros2aria --ros-args -p pioneer_id:=${PIONEER_ID} \ No newline at end of file + network_mode: host + ipc: host + command: ros2 run ros2aria ros2aria --ros-args -p pioneer_id:=${PIONEER_ID} + devices: + - /dev/ttyS0 diff --git a/src/pioneer_description/CMakeLists.txt b/src/pioneer_description/CMakeLists.txt new file mode 100644 index 0000000..cdbbc4b --- /dev/null +++ b/src/pioneer_description/CMakeLists.txt @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 3.8) +project(pioneer_description) + +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +# find dependencies +find_package(ament_cmake REQUIRED) +# uncomment the following section in order to fill in +# further dependencies manually. +# find_package( REQUIRED) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + # the following line skips the linter which checks for copyrights + # comment the line when a copyright and license is added to all source files + set(ament_cmake_copyright_FOUND TRUE) + # the following line skips cpplint (only works in a git repo) + # comment the line when this package is in a git repo and when + # a copyright and license is added to all source files + set(ament_cmake_cpplint_FOUND TRUE) + ament_lint_auto_find_test_dependencies() +endif() + +install(DIRECTORY urdf launch + DESTINATION share/${PROJECT_NAME} +) + +ament_package() diff --git a/src/pioneer_description/launch/pioneer_description.launch.py b/src/pioneer_description/launch/pioneer_description.launch.py new file mode 100644 index 0000000..cf6fd8e --- /dev/null +++ b/src/pioneer_description/launch/pioneer_description.launch.py @@ -0,0 +1,37 @@ +from launch_ros.substitutions import FindPackageShare +from launch_ros.actions import Node +from launch.substitutions import Command, LaunchConfiguration, PythonExpression +from launch.conditions import IfCondition, UnlessCondition +from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription +import launch +from launch.substitutions import Command, LaunchConfiguration +import launch_ros +import os +from ament_index_python.packages import get_package_share_directory +from launch import LaunchDescription +from launch.substitutions import LaunchConfiguration +from launch.actions import IncludeLaunchDescription, DeclareLaunchArgument +from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch.conditions import IfCondition + + +def generate_launch_description(): + pkg_share = launch_ros.substitutions.FindPackageShare( + package='pioneer_description').find('micromouse_description') + + default_model_path = os.path.join( + pkg_share, 'urdf/pioneer3dx.urdf.xacro') + + robot_state_publisher_node = launch_ros.actions.Node( + namespace='pioneer5', + package='robot_state_publisher', + executable='robot_state_publisher', + parameters=[{'robot_description': Command( + ['xacro ', LaunchConfiguration('model')])}] + ) + + return launch.LaunchDescription([ + launch.actions.DeclareLaunchArgument(name='model', default_value=default_model_path, + description='Absolute path to robot urdf file'), + robot_state_publisher_node, + ]) diff --git a/src/pioneer_description/package.xml b/src/pioneer_description/package.xml new file mode 100644 index 0000000..1e31bf7 --- /dev/null +++ b/src/pioneer_description/package.xml @@ -0,0 +1,18 @@ + + + + pioneer_description + 0.0.0 + TODO: Package description + deli + TODO: License declaration + + ament_cmake + + ament_lint_auto + ament_lint_common + + + ament_cmake + + diff --git a/src/pioneer_description/urdf/pioneer3dx.urdf b/src/pioneer_description/urdf/pioneer3dx.urdf new file mode 100644 index 0000000..a6e0a7d --- /dev/null +++ b/src/pioneer_description/urdf/pioneer3dx.urdf @@ -0,0 +1,367 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gazebo/Black + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + 100 + left_wheel_joint + right_wheel_joint + 0.158 + 0.12 + 5 + + cmd_vel + base_link + odom + odom + + + + + \ No newline at end of file diff --git a/src/ros2aria/src/ros2aria.cpp b/src/ros2aria/src/ros2aria.cpp index 4e6b5f6..c6d778d 100644 --- a/src/ros2aria/src/ros2aria.cpp +++ b/src/ros2aria/src/ros2aria.cpp @@ -18,7 +18,7 @@ Ros2Aria::Ros2Aria() sonar_pub_ = this->create_publisher("sonar", 10); sonar_pointcloud2_pub_ = this->create_publisher("sonar_pointcloud2", 10); - pose_pub_ = this->create_publisher("pose", 1000); + pose_pub_ = this->create_publisher("odom/wheels", 1000); wheels_pub_ = this->create_publisher("wheels", 1000);