Skip to content

Commit 5509d05

Browse files
authored
Merge pull request #441 from alliander-opensource/438-integrate-xsens-imu
438 integrate xsens imu
2 parents 9a2ea1e + cf5e012 commit 5509d05

35 files changed

Lines changed: 1263 additions & 62 deletions

File tree

.devcontainer/dev/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ RUN apt update && apt install -y --no-install-recommends \
1818

1919
# Install MoveIt:
2020
RUN apt update && apt install -y --no-install-recommends \
21+
ros-$ROS_DISTRO-imu-filter-madgwick \
2122
ros-$ROS_DISTRO-moveit \
2223
ros-$ROS_DISTRO-moveit-servo \
2324
ros-$ROS_DISTRO-moveit-visual-tools \
@@ -64,6 +65,7 @@ COPY alliander_joystick/src/ /alliander/ros/src
6465
COPY alliander_meta/src/ /alliander/ros/src
6566
COPY alliander_moveit/src/ /alliander/ros/src
6667
COPY alliander_nav2/src/ /alliander/ros/src
68+
COPY alliander_xsens/src/ /alliander/ros/src
6769

6870
# Build repo packages:
6971
RUN /alliander/colcon_build.sh

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ clangd/
2222
.venv
2323

2424
# for LSP in neovim
25+
.nvim/
2526
**/compile_commands.json
2627

2728
# generated compose files

alliander_core/src/alliander_description/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ find_package(ament_cmake_python REQUIRED)
1111

1212
# Shared folders:
1313
install(
14-
DIRECTORY franka husarion ouster velodyne realsense zed nmea_gps ewellix
14+
DIRECTORY ewellix franka husarion nmea_gps ouster realsense velodyne xsens zed
1515
DESTINATION share/${PROJECT_NAME}
1616
)
1717

alliander_core/src/alliander_description/husarion/urdf/original/gazebo.urdf.xacro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,4 @@
141141
</gazebo>
142142
</xacro:macro>
143143

144-
</robot>
144+
</robot>
195 KB
Binary file not shown.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: Alliander N. V.
2+
3+
SPDX-License-Identifier: Apache-2.0
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
SPDX-FileCopyrightText: Alliander N. V.
4+
SPDX-License-Identifier: Apache-2.0
5+
-->
6+
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="imu_module">
7+
8+
<xacro:macro name="xsens_imu"
9+
params="
10+
namespace
11+
parent
12+
name:=xsens
13+
use_sim:=false
14+
">
15+
16+
<link name="base_link"/>
17+
<link name="imu_link">
18+
19+
<visual>
20+
<origin xyz="0 0 0" rpy="0 0 0"/>
21+
<geometry>
22+
<mesh filename="package://alliander_description/xsens/meshes/MTi-6x0R.stl" scale="0.001 0.001 0.001"/>
23+
</geometry>
24+
<material name="dark_grey">
25+
<color rgba="0.2 0.2 0.2 1.0"/>
26+
</material>
27+
</visual>
28+
29+
<collision>
30+
<origin xyz="0 0 0" rpy="0 0 0"/>
31+
<geometry>
32+
<!-- 56.5 x 40.9 x 24.75 mm in metres -->
33+
<box size="0.0565 0.0409 0.02475"/>
34+
</geometry>
35+
</collision>
36+
37+
<inertial>
38+
<!-- Approximate mass: 50g -->
39+
<mass value="0.050"/>
40+
<origin xyz="0 0 0" rpy="0 0 0"/>
41+
<!-- Box inertia tensor: I = m/12 * (a² + b²) for each axis -->
42+
<inertia ixx="8.22e-6" ixy="0" ixz="0"
43+
iyy="1.59e-5" iyz="0"
44+
izz="2.03e-5"/>
45+
</inertial>
46+
47+
</link>
48+
49+
<!-- Gazebo requires a joint to a link called "world" for statically mounted robots -->
50+
<xacro:if value="${parent == 'world'}">
51+
<link name="${parent}" />
52+
<joint name="${parent}_joint" type="fixed">
53+
<parent link="${parent}" />
54+
<child link="base_link" />
55+
</joint>
56+
</xacro:if>
57+
58+
<!-- Since Xsens publishes data on imu_link on hardware -->
59+
<joint name="imu_joint" type="fixed">
60+
<parent link="base_link"/>
61+
<child link="imu_link"/>
62+
<origin xyz="0 0 0" rpy="0 0 0"/>
63+
</joint>
64+
65+
<!-- MTi-6x0 IMU sensor specification: https://www.xsens.com/hubfs/Downloads/Manuals/MTi-600-series-datasheet.pdf -->
66+
<xacro:if value="${use_sim}">
67+
<gazebo reference="imu_link">
68+
<sensor name="${namespace}/imu" type="imu">
69+
<always_on>true</always_on>
70+
<update_rate>100</update_rate>
71+
<topic>${namespace}/imu/data</topic>
72+
<visualize>false</visualize>
73+
<enable_metrics>false</enable_metrics>
74+
<gz_frame_id>${namespace}/imu_link</gz_frame_id>
75+
<imu>
76+
<orientation_reference_frame>
77+
<localization>ENU</localization>
78+
</orientation_reference_frame>
79+
<angular_velocity>
80+
<!-- Gyroscope noise density: 0.01 deg/s/sqrt(Hz), in-run bias: 2 deg/h -->
81+
<x><noise type="gaussian"><mean>0.0</mean><stddev>1.75e-4</stddev><bias_mean>9.7e-6</bias_mean><bias_stddev>0.0</bias_stddev></noise></x>
82+
<y><noise type="gaussian"><mean>0.0</mean><stddev>1.75e-4</stddev><bias_mean>9.7e-6</bias_mean><bias_stddev>0.0</bias_stddev></noise></y>
83+
<z><noise type="gaussian"><mean>0.0</mean><stddev>1.75e-4</stddev><bias_mean>9.7e-6</bias_mean><bias_stddev>0.0</bias_stddev></noise></z>
84+
</angular_velocity>
85+
<linear_acceleration>
86+
<!-- Accelerometer noise density: 0.003 m/s²/sqrt(Hz), in-run bias: 0.01 mg -->
87+
<x><noise type="gaussian"><mean>0.0</mean><stddev>3.0e-3</stddev><bias_mean>9.8e-5</bias_mean><bias_stddev>0.0</bias_stddev></noise></x>
88+
<y><noise type="gaussian"><mean>0.0</mean><stddev>3.0e-3</stddev><bias_mean>9.8e-5</bias_mean><bias_stddev>0.0</bias_stddev></noise></y>
89+
<z><noise type="gaussian"><mean>0.0</mean><stddev>3.0e-3</stddev><bias_mean>9.8e-5</bias_mean><bias_stddev>0.0</bias_stddev></noise></z>
90+
</linear_acceleration>
91+
</imu>
92+
</sensor>
93+
</gazebo>
94+
</xacro:if>
95+
96+
</xacro:macro>
97+
98+
<xacro:arg name="namespace" default="xsens" />
99+
<xacro:arg name="parent" default="" />
100+
<xacro:arg name="use_sim" default="false" />
101+
<xacro:xsens_imu
102+
namespace="$(arg namespace)"
103+
parent="$(arg parent)"
104+
use_sim="$(arg use_sim)" />
105+
106+
</robot>

alliander_core/src/alliander_utilities/alliander_utilities/config_objects.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,19 @@ class GPS(Platform):
337337
diagnostic_timeouts: tuple[int, int, int] = (3, 5, 10)
338338

339339

340+
@dataclass
341+
class IMU(Platform):
342+
"""Configuration for an IMU platform.
343+
344+
Attributes:
345+
platform_type (str): Type identifier for the platform.
346+
usb_device (str): USB device path, e.g. /dev/imu.
347+
"""
348+
349+
platform_type: str = "IMU"
350+
usb_device: str = "/dev/imu"
351+
352+
340353
@dataclass
341354
class Lift(Platform):
342355
"""Configuration for a Lift platform.
@@ -359,7 +372,7 @@ class PlatformList(Config):
359372

360373
platforms: List[
361374
Annotated[
362-
Union[Platform, Arm, Vehicle, Lidar, Camera, GPS, Lift],
375+
Union[Platform, Arm, Vehicle, Camera, GPS, IMU, Lidar, Lift],
363376
Discriminator(field="platform_type", include_supertypes=True),
364377
]
365378
] = field(default_factory=list)

alliander_gazebo/src/alliander_gazebo/launch/gazebo.launch.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ def get_bridge_topics(platforms: list[T]) -> list[str]:
8383
bridge_topics.append(
8484
f"/{platform.namespace}/gps/fix@sensor_msgs/msg/NavSatFix@gz.msgs.NavSat"
8585
)
86+
if platform.platform_type == "IMU":
87+
bridge_topics.append(
88+
f"/{platform.namespace}/imu/data@sensor_msgs/msg/Imu@gz.msgs.IMU"
89+
)
8690
return bridge_topics
8791

8892

alliander_gps/alliander_gps.Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ ENV ROS_DISTRO=jazzy
1111
RUN apt update && apt install -y --no-install-recommends \
1212
ros-$ROS_DISTRO-husarion-components-description \
1313
ros-$ROS_DISTRO-nmea-navsat-driver \
14-
ros-$ROS_DISTRO-robot-localization \
1514
&& rm -rf /var/lib/apt/lists/* \
1615
&& apt autoremove -y \
1716
&& apt clean

0 commit comments

Comments
 (0)