Skip to content

Commit 77c180d

Browse files
Added EKF support
1 parent 0864dff commit 77c180d

File tree

5 files changed

+63
-4
lines changed

5 files changed

+63
-4
lines changed

.gitignore

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
build/*
2-
install/*
3-
log/*
1+
build/
2+
install/
3+
log/
44
.vscode/
55

66
# Prerequisites

src/xerbo_description/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ endif()
88
find_package(ament_cmake REQUIRED)
99

1010
install(
11-
DIRECTORY src launch rviz
11+
DIRECTORY src launch rviz config
1212
DESTINATION share/${PROJECT_NAME}
1313
)
1414

src/xerbo_description/config/ekf.yaml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
### ekf config file ###
2+
ekf_filter_node:
3+
ros__parameters:
4+
# The frequency, in Hz, at which the filter will output a position estimate. Note that the filter will not begin
5+
# computation until it receives at least one message from one of theinputs. It will then run continuously at the
6+
# frequency specified here, regardless of whether it receives more measurements. Defaults to 30 if unspecified.
7+
frequency: 30.0
8+
9+
# ekf_localization_node and ukf_localization_node both use a 3D omnidirectional motion model. If this parameter is
10+
# set to true, no 3D information will be used in your state estimate. Use this if you are operating in a planar
11+
# environment and want to ignore the effect of small variations in the ground plane that might otherwise be detected
12+
# by, for example, an IMU. Defaults to false if unspecified.
13+
two_d_mode: false
14+
15+
# Whether to publish the acceleration state. Defaults to false if unspecified.
16+
publish_acceleration: true
17+
18+
# Whether to broadcast the transformation over the /tf topic. Defaultsto true if unspecified.
19+
publish_tf: true
20+
21+
# 1. Set the map_frame, odom_frame, and base_link frames to the appropriate frame names for your system.
22+
# 1a. If your system does not have a map_frame, just remove it, and make sure "world_frame" is set to the value of odom_frame.
23+
# 2. If you are fusing continuous position data such as wheel encoder odometry, visual odometry, or IMU data, set "world_frame"
24+
# to your odom_frame value. This is the default behavior for robot_localization's state estimation nodes.
25+
# 3. If you are fusing global absolute position data that is subject to discrete jumps (e.g., GPS or position updates from landmark
26+
# observations) then:
27+
# 3a. Set your "world_frame" to your map_frame value
28+
# 3b. MAKE SURE something else is generating the odom->base_link transform. Note that this can even be another state estimation node
29+
# from robot_localization! However, that instance should *not* fuse the global data.
30+
map_frame: map # Defaults to "map" if unspecified
31+
odom_frame: odom # Defaults to "odom" if unspecified
32+
base_link_frame: base_link # Defaults to "base_link" ifunspecified
33+
world_frame: odom # Defaults to the value ofodom_frame if unspecified
34+
35+
odom0: odom
36+
odom0_config: [true, true, true,
37+
false, false, false,
38+
false, false, false,
39+
false, false, true,
40+
false, false, false]
41+
42+
imu0: demo/imu
43+
imu0_config: [false, false, false,
44+
true, true, true,
45+
false, false, false,
46+
false, false, false,
47+
false, false, false]

src/xerbo_description/launch/display.launch.py

+11
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ def generate_launch_description():
3636
output='screen'
3737
)
3838

39+
robot_localization_node = launch_ros.actions.Node(
40+
package='robot_localization',
41+
executable='ekf_node',
42+
name='ekf_filter_node',
43+
output='screen',
44+
parameters=[os.path.join(pkg_share, 'config/ekf.yaml'), {'use_sim_time': LaunchConfiguration('use_sim_time')}]
45+
)
46+
3947
return launch.LaunchDescription([
4048
launch.actions.DeclareLaunchArgument(name='gui', default_value='True',
4149
description='Flag to enable joint_state_publisher_gui'),
@@ -44,8 +52,11 @@ def generate_launch_description():
4452
launch.actions.DeclareLaunchArgument(name='rvizconfig', default_value=default_rviz_config_path,
4553
description='Absolute path to rviz config file'),
4654
launch.actions.ExecuteProcess(cmd=['gazebo', '--verbose', '-s', 'libgazebo_ros_factory.so'], output='screen'),
55+
launch.actions.DeclareLaunchArgument(name='use_sim_time', default_value='True',
56+
description='Flag to enable use_sim_time'),
4757
joint_state_publisher_node,
4858
robot_state_publisher_node,
4959
spawn_entity,
60+
robot_localization_node,
5061
rviz_node
5162
])

src/xerbo_description/package.xml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<exec_depend>robot_state_publisher</exec_depend>
1414
<exec_depend>rviz</exec_depend>
1515
<exec_depend>xacro</exec_depend>
16+
<exec_depend>robot_localization</exec_depend>
1617

1718
<test_depend>ament_lint_auto</test_depend>
1819
<test_depend>ament_lint_common</test_depend>

0 commit comments

Comments
 (0)