Skip to content

Commit 238dc89

Browse files
committed
Add IMU test
1 parent 2cd0381 commit 238dc89

8 files changed

+368
-2
lines changed

fuse_models/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ install(
149149

150150
if(CATKIN_ENABLE_TESTING)
151151
find_package(rostest REQUIRED)
152+
find_package(catkin REQUIRED COMPONENTS angles)
152153

153154
# Lint tests
154155
roslint_add_test()

fuse_models/package.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
<exec_depend>message_runtime</exec_depend>
4141

42+
<test_depend>angles</test_depend>
4243
<!-- The official rosdep has an entry for Google's benchmark deb
4344
(https://github.com/ros/rosdistro/blob/2cbcebdedcc1e827501acfecaf2386cd33f26809/rosdep/base.yaml#L232-L239)
4445
since https://github.com/ros/rosdistro/pull/23163 got merged.
@@ -52,6 +53,11 @@
5253
For this reason we conditionally test_depend on benchmark only if the $ROS_DISTRO is ROS Melodic or newer.
5354
-->
5455
<test_depend condition="$ROS_DISTRO >= melodic">benchmark</test_depend>
56+
<test_depend>controller_manager</test_depend>
57+
<test_depend>diff_drive_controller</test_depend>
58+
<test_depend>gazebo_ros</test_depend>
59+
<test_depend>joint_state_controller</test_depend>
60+
<test_depend>robot_state_publisher</test_depend>
5561
<test_depend>rostest</test_depend>
5662

5763
<export>

fuse_models/test/diffbot.launch

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,9 @@
2222

2323
<!-- Spawn controller -->
2424
<node name="controller_spawner" pkg="controller_manager" type="spawner"
25-
args="diffbot_controller"/>
25+
args="joint_state_controller
26+
diffbot_controller"/>
27+
28+
<!-- Convert joint states to TF transforms -->
29+
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"/>
2630
</launch>

fuse_models/test/diffbot.xacro

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
<bodyName>imu_link</bodyName>
7878
<updateRateHZ>50.0</updateRateHZ>
7979
<frameName>imu_link</frameName>
80-
<gaussianNoise>0.001</gaussianNoise>
80+
<gaussianNoise>1.0e-6</gaussianNoise>
8181
<xyzOffset>0 0 0</xyzOffset>
8282
<rpyOffset>0 0 0</rpyOffset>
8383
<initialOrientationAsReference>false</initialOrientationAsReference>
@@ -93,6 +93,16 @@
9393
</plugin>
9494
</gazebo>
9595

96+
<!-- ground truth plugin -->
97+
<gazebo>
98+
<plugin name="gazebo_ros_p3d" filename="libgazebo_ros_p3d.so">
99+
<bodyName>base_link</bodyName>
100+
<topicName>ground_truth_odom</topicName>
101+
<alwaysOn>true</alwaysOn>
102+
<updateRate>50.0</updateRate>
103+
</plugin>
104+
</gazebo>
105+
96106
<!-- Colour -->
97107
<gazebo reference="base_link">
98108
<material>Gazebo/Green</material>

fuse_models/test/diffbot_controllers.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Publish all joint states
2+
joint_state_controller:
3+
type: joint_state_controller/JointStateController
4+
publish_rate: 50
5+
6+
# Diff drive controller
17
diffbot_controller:
28
type: "diff_drive_controller/DiffDriveController"
39
left_wheel: 'wheel_0_joint'

fuse_models/test/imu.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
imu:
2+
topic: /imu
3+
angular_velocity_dimensions: ['yaw']
4+
differential: true
5+
orientation_dimensions: ['yaw']
6+
orientation_target_frame: &target_frame base_link
7+
twist_target_frame: *target_frame

fuse_models/test/imu_2d.test

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<launch>
2+
<!-- Simulat robot -->
3+
<include file="$(find fuse_models)/test/diffbot.launch"/>
4+
5+
<!-- Load IMU sensor configuration -->
6+
<rosparam file="$(find fuse_models)/test/imu.yaml" command="load" ns="imu_2d_test"/>
7+
8+
<!-- Run test -->
9+
<test test-name="imu_2d_test" pkg="fuse_models" type="test_imu_2d" time-limit="120">
10+
<remap from="odom" to="/ground_truth_odom"/>
11+
</test>
12+
</launch>

0 commit comments

Comments
 (0)