0
$\begingroup$

using ubuntu 18.04 melodic i am currently trying to do amcl with my robot with a generated map from gmapping my map now cannot be spawned normally and the robot is alw at the corner , please help me , thankyou

my launch file:

<node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen"
      args="limo_state_controller limo_fl_steering_hinge_controller limo_fr_steering_hinge_controller"/>

<!-- Robot state publisher for URDF visualization -->
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" />

<!-- Joint State Publisher for the wheels -->
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher">
    <param name="use_gui" value="false"/> <!-- Set to true if you want to use the GUI -->
</node>

<!-- Use robot pose ekf to provide odometry -->
<node pkg="robot_pose_ekf" name="robot_pose_ekf" type="robot_pose_ekf">
    <param name="output_frame" value="odom" />
    <param name="base_frame_id" value="base_footprint"/>
    <remap from="imu_data" to="imu" />
</node>

<!-- Launch AMCL for localization -->
<node pkg="amcl" type="amcl" name="amcl" output="screen">
    <rosparam file="$(find limo_bringup)/param/amcl_params_omni.yaml" command="load" />
    <param name="initial_pose_x" value="0" />
    <param name="initial_pose_y" value="0" />
    <param name="initial_pose_a" value="0" />
    <param name="global_frame_id" value="map" />
    <param name="map_file" value="$(find limo_bringup)/maps/mylimomap.yaml" />
</node>

<!-- Launch RViz with the amcl.rviz configuration -->
<node name="rviz_amcl" pkg="rviz" type="rviz" args="-d $(find limo_bringup)/rviz/amcl.rviz" />

amcl_params_diff.yaml file: link

Picture of terminal when launching file: link

Image of Rviz : link

Link of TF tree : link

$\endgroup$
1

2 Answers 2

1
$\begingroup$

Typically you would just use the "2D Pose Estimate" button in RVIZ to locate the robot in the map where it is in reality.

But if you wanted it to spawn in a specific place, just fill in the coordinates in your file:

<param name="initial_pose_x" value="1" />
<param name="initial_pose_y" value="1" />
<param name="initial_pose_a" value="0" />
<param name="global_frame_id" value="map" />

and it would spawn at 1 , 1.

$\endgroup$
1
  • $\begingroup$ hello @billy thankyou for the help, i tried what u asked me to do but the map still shows error and the robot is still at the corner of the map $\endgroup$
    – tim
    Nov 3, 2023 at 7:08
1
$\begingroup$

First of all, make sure the Global Frame you are using in RVIZ is map, since you won't be able to set a 2D Pose Estimation if you are not on that frame.

Watching your TF tree, odom frame is missing. Could you check if robot_pose_ekf is working properly? You will need the odom -> base_footprint tf before you can see the map -> odom tf that AMCL publishes in your TF tree (here is the info from the AMCL Wiki link)

$\endgroup$
3
  • $\begingroup$ hello,thankyou for helping . currently i have set my global frame fixed frame to "base_footprint" because if i switch to map , the robot model or urdf file would not be shown . Yes Robot_pose_ekf node shows that it is working properly in the terminal when launching. So now i need the odom frame? isit possible to let me know how to find the odom tf , much appreciated $\endgroup$
    – tim
    Nov 3, 2023 at 7:35
  • $\begingroup$ This is a ROS1 tutorial but any notes about setting ODOM will apply to ROS2 as well. wiki.ros.org/navigation/Tutorials/RobotSetup $\endgroup$
    – billy
    Nov 3, 2023 at 15:45
  • $\begingroup$ As billy pointed out, there you have information about how to setup odometry. Is it clear now? If yes please select one of the two answers in order to know that your issue is solved. $\endgroup$
    – ÁngeLoGa
    Nov 6, 2023 at 11:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.