Skip to content

Commit

Permalink
Merge branch 'ElettraSciComp:ros2' into ros2
Browse files Browse the repository at this point in the history
  • Loading branch information
jemmmel authored Aug 28, 2024
2 parents c5ebf37 + b5caf71 commit 6e1d31a
Show file tree
Hide file tree
Showing 5 changed files with 165 additions and 127 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: ROS2 CI

on:
pull_request:
branches:
- 'develop'
- 'ros2'
push:
branches:
- 'ros2'

jobs:
test_environment:
runs-on: [ubuntu-latest]
strategy:
fail-fast: false
matrix:
ros_distribution:
- humble
- iron
- rolling
include:
# Humble Hawksbill (May 2022 - May 2027)
- docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-humble-ros-base-latest
ros_distribution: humble
ros_version: 2
# Iron Irwini (May 2023 - May 2028)
- docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-rolling-ros-base-latest
ros_distribution: iron
ros_version: 2
# Rolling Ridley (June 2020 - Present)
- docker_image: rostooling/setup-ros-docker:ubuntu-jammy-ros-rolling-ros-base-latest
ros_distribution: rolling
ros_version: 2
container:
image: ${{ matrix.docker_image }}
steps:
- name: checkout
uses: actions/checkout@v2
- name: install deps
run: sudo apt-get -y install qtbase5-dev libqt5serialport5-dev
- name: build and test
uses: ros-tooling/action-ros-ci@master
with:
target-ros2-distro: ${{ matrix.ros_distribution }}
vcs-repo-file-url: ""
skip-tests: true
38 changes: 18 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,8 @@ endif()

add_subdirectory(witmotion-uart-qt)

#set(CMAKE_AUTOMOC ON)
#qt5_wrap_cpp(MOC_SOURCES include/witmotion_ros.h)
include_directories(include)
include_directories(/opt/ros/humble/include/tf2_geometry_msgs)
include_directories(/opt/ros/iron/include/tf2_geometry_msgs)
include_directories(witmotion-uart-qt/include)
#add_library(witmotion_ros src/witmotion_ros.cpp include/witmotion_ros.h)


find_package(ament_cmake REQUIRED)
Expand Down Expand Up @@ -55,27 +50,30 @@ add_library(witmotion_ros

message(WARNING "tf2_geometry_msgs include dir: ${tf2_geometry_msgs_INCLUDE_DIRS} ")

#find_package(Qt5 REQUIRED COMPONENTS Core SerialPort)
set(INCLUDE_DIRS ${ament_cmake_INCLUDE_DIRS} ${tf2_INCLUDE_DIRS}
${tf2_geometry_msgs_INCLUDE_DIRS} ${rclcpp_INCLUDE_DIRS}
${std_srvs_INCLUDE_DIRS} ${sensor_msgs_INCLUDE_DIRS}
${geometry_msgs_INCLUDE_DIRS} ${nav_msgs_INCLUDE_DIRS}
${rosgraph_msgs_INCLUDE_DIRS} ${std_msgs_INCLUDE_DIRS} ${Qt5Core_INCLUDE_DIRS} ${Qt5SerialPort_INCLUDE_DIRS} ${rcl_interfaces_INCLUDE_DIRS}
${rclcpp_lifecycle_INCLUDE_DIRS} ${lifecycle_msgs_INCLUDE_DIRS})
include_directories(${INCLUDE_DIRS})

set(dependencies
tf2
tf2_geometry_msgs
rclcpp
std_srvs
sensor_msgs
std_msgs
rcl_interfaces
rclcpp_lifecycle
lifecycle_msgs
)
ament_target_dependencies(witmotion_ros ${dependencies})

find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()


set(LIBRARY_DIRS ${ament_cmake_LIBRARIES} ${tf2_LIBRARIES}
${tf2_geometry_msgs_LIBRARIES} ${rclcpp_LIBRARIES} ${std_srvs_LIBRARIES}
${sensor_msgs_LIBRARIES} ${geometry_msgs_LIBRARIES}
${nav_msgs_LIBRARIES} ${rosgraph_msgs_LIBRARIES}
${std_msgs_LIBRARIES} ${Qt5Core_LIBRARIES} ${Qt5SerialPort_LIBRARIES} ${rcl_interfaces_LIBRARIES} ${rclcpp_lifecycle_LIBRARIES} ${lifecycle_msgs_LIBRARIES})

#target_link_libraries(another PUBLIC one)
set(LIBS ${ament_cmake_LIBRARIES} ${tf2_LIBRARIES}
${tf2_geometry_msgs_LIBRARIES} ${rclcpp_LIBRARIES} ${std_srvs_LIBRARIES}
${sensor_msgs_LIBRARIES} ${geometry_msgs_LIBRARIES}
${nav_msgs_LIBRARIES} ${rosgraph_msgs_LIBRARIES}
${std_msgs_LIBRARIES} ${Qt5Core_LIBRARIES} ${Qt5SerialPort_LIBRARIES} ${rcl_interfaces_LIBRARIES} ${rclcpp_lifecycle_LIBRARIES} ${lifecycle_msgs_LIBRARIES})

target_link_libraries(witmotion_ros ${LIBRARY_DIRS} witmotion-uart Qt5::Core Qt5::SerialPort)


Expand Down
4 changes: 4 additions & 0 deletions include/witmotion_ros.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <ctime>

#include <rclcpp/rclcpp.hpp>
#include <rclcpp/parameter.hpp>
#include <rclcpp_lifecycle/lifecycle_node.hpp>
#include <sensor_msgs/msg/imu.hpp>
#include <sensor_msgs/msg/magnetic_field.hpp>
Expand Down Expand Up @@ -164,6 +165,9 @@ class ROSWitmotionSensorController: public QObject
public:
static ROSWitmotionSensorController& Instance();
rclcpp::Node::SharedPtr Start();
void load_parameter(bool is_active, std::string param_name, double first_val, std::vector<double> &param_vector);
void load_parameter_d(std::string param_name, double init_val, double &param_var);
void load_parameter_f(std::string param_name, float init_val, float &param_var);
public slots:
void Packet(const witmotion_datapacket& packet);
void Error(const QString& description);
Expand Down
41 changes: 16 additions & 25 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,25 @@
<package format="3">
<name>witmotion_ros</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<description>Witmotion IMU sensor driver for ROS</description>
<maintainer email="[email protected]">pi</maintainer>
<license>TODO: License declaration</license>
<license>MIT</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<build_depend>rclcpp</build_depend>
<build_depend>sensor_msgs</build_depend>
<build_depend>geometry_msgs</build_depend>
<build_depend>message_runtime</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>std_srvs</build_depend>
<build_depend>nav_core</build_depend>
<build_depend>nav_msgs</build_depend>
<build_depend>tf2</build_depend>
<build_depend>tf2_geometry_msgs</build_depend>
<build_depend>rosgraph_msgs</build_depend>
<exec_depend>rclcpp</exec_depend>
<exec_depend>sensor_msgs</exec_depend>
<exec_depend>geometry_msgs</exec_depend>
<exec_depend>message_runtime</exec_depend>
<exec_depend>std_msgs</exec_depend>
<exec_depend>std_srvs</exec_depend>
<exec_depend>nav_core</exec_depend>
<exec_depend>nav_msgs</exec_depend>
<exec_depend>rosgraph_msgs</exec_depend>
<exec_depend>tf2</exec_depend>
<exec_depend>tf2_geometry_msgs</exec_depend>
<exec_depend>libqt5-serialport-dev</exec_depend>
<buildtool_depend>ament_cmake_auto</buildtool_depend>

<depend>tf2_geometry_msgs</depend>
<depend>rclcpp</depend>
<depend>std_srvs</depend>
<depend>rcl_interfaces</depend>
<depend>rclcpp_lifecycle</depend>
<depend>lifecycle_msgs</depend>
<depend>qtbase5-dev</depend>
<depend>libqt5-serialport</depend>
<depend>boost</depend>
<depend>nav_msgs</depend>
<depend>std_msgs</depend>
<depend>tf2</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
Expand Down
Loading

0 comments on commit 6e1d31a

Please sign in to comment.