diff --git a/config/diffbot_controllers.yaml b/config/diffbot_controllers.yaml index 842acf8..132a702 100644 --- a/config/diffbot_controllers.yaml +++ b/config/diffbot_controllers.yaml @@ -35,7 +35,7 @@ diffbot_base_controller: [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 1000.0] # changed from https://github.com/kallaspriit/rosbot/blob/main/ros/src/rosbot_description/config/diff_drive_controller.yaml open_loop: false - enable_odom_tf: true + #enable_odom_tf: true #disabled because tf will be handled by robot_localizaion node in the future (imu sensor fusion) cmd_vel_timeout: 0.5 #publish_limited_velocity: true diff --git a/config/ekf.yaml b/config/ekf.yaml new file mode 100644 index 0000000..0d3e511 --- /dev/null +++ b/config/ekf.yaml @@ -0,0 +1,57 @@ +### ekf config file ### +ekf_filter_node: + ros__parameters: +# The frequency, in Hz, at which the filter will output a position estimate. Note that the filter will not begin +# computation until it receives at least one message from one of theinputs. It will then run continuously at the +# frequency specified here, regardless of whether it receives more measurements. Defaults to 30 if unspecified. + frequency: 30.0 + +# ekf_localization_node and ukf_localization_node both use a 3D omnidirectional motion model. If this parameter is +# set to true, no 3D information will be used in your state estimate. Use this if you are operating in a planar +# environment and want to ignore the effect of small variations in the ground plane that might otherwise be detected +# by, for example, an IMU. Defaults to false if unspecified. + two_d_mode: false + +# Whether to publish the acceleration state. Defaults to false if unspecified. + publish_acceleration: true + +# Whether to broadcast the transformation over the /tf topic. Defaultsto true if unspecified. + publish_tf: true + +# 1. Set the map_frame, odom_frame, and base_link frames to the appropriate frame names for your system. +# 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. +# 2. If you are fusing continuous position data such as wheel encoder odometry, visual odometry, or IMU data, set "world_frame" +# to your odom_frame value. This is the default behavior for robot_localization's state estimation nodes. +# 3. If you are fusing global absolute position data that is subject to discrete jumps (e.g., GPS or position updates from landmark +# observations) then: +# 3a. Set your "world_frame" to your map_frame value +# 3b. MAKE SURE something else is generating the odom->base_link transform. Note that this can even be another state estimation node +# from robot_localization! However, that instance should *not* fuse the global data. + map_frame: map # Defaults to "map" if unspecified + odom_frame: odom # Defaults to "odom" if unspecified + base_link_frame: base_link # Defaults to "base_link" ifunspecified + world_frame: odom # Defaults to the value ofodom_frame if unspecified + + odom0: /odom + # The order of the values of this parameter is x, y, z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw, ax, ay, az. + # Configure it for x,y,z,vyaw on the odom topic + odom0_config: [true, true, true, + false, false, false, + false, false, false, + false, false, true, + false, false, false] + + + imu0: /imu/data_raw + # The order of the values of this parameter is x, y, z, roll, pitch, yaw, vx, vy, vz, vroll, vpitch, vyaw, ax, ay, az. + # Configure it for ax,ay,az linear acceleration data for now. Shall not contain values already derived by each other. + # Example: Since angular velocity is fused internally to the IMU to provide the roll, pitch and yaw estimates, we should not fuse in the angular velocities used to derive that information. We also do not fuse in angular velocity due to the noisy characteristics it has when not using exceptionally high quality (and expensive) IMUs. + imu0_config: [false, false, false, + false, false, false, + false, false, false, + false, false, false, + true, true, true] + + # [ADVANCED] Some IMUs automatically remove acceleration due to gravity, and others don't. If yours doesn't, please set + # this to true, and *make sure* your data conforms to REP-103, specifically, that the data is in ENU frame. + imu0_remove_gravitational_acceleration: true \ No newline at end of file diff --git a/launch/robot_localization.launch.py b/launch/robot_localization.launch.py index 36c61eb..04d2a31 100644 --- a/launch/robot_localization.launch.py +++ b/launch/robot_localization.launch.py @@ -118,6 +118,22 @@ def generate_launch_description(): parameters=[lidar_dir], ) + robot_localization_node = Node( + package='robot_localization', + executable='ekf_node', + name='ekf_filter_node', + output='screen', + parameters = [ PathJoinSubstitution( + [ + FindPackageShare("bot_mini_bringup"), + "config", + "ekf.yaml" + ] + ) , + #{'use_sim_time': LaunchConfiguration('use_sim_time')} + ] + ) + return LaunchDescription([ #control_node, #robot_state_pub_node, @@ -127,5 +143,6 @@ def generate_launch_description(): #teleop_spawner, #cam_node, #lidar_node, - mapper_node + #mapper_node, + robot_localization_node ]) \ No newline at end of file diff --git a/package.xml b/package.xml index 11a1ae4..34cb978 100644 --- a/package.xml +++ b/package.xml @@ -21,6 +21,7 @@ ros2_cam_openCV joy twist_mux + robot_localization ament_python