Model in gazebo goes forward crashing into the wall while model display in rviz goes backwards - Hector autonomous nav
Hello,
I am new to navigation and ROS generally and I am trying to use hector_slam and hector_navigation metapackages to implement autonomous navigation to my 3 wheel robot with a lidar on it.
I did the following:
Spawn my robot in a maze that I built with boxes in gazebo.
Roslaunch labrob_gazebo state_publisher.launch
Rosrun tf_base_link_to_map_broadcaster_node --> I wrote this node, could be the problem be here ? This tf is being used from the hector_exploration_node.
Roslaunch hector_mapping mapping_default.launch --> Got correct map data from teleoperating the robot in there.
Roslaunch hector_exploration_node exploration_planner.launch
Rosrun hector_exploration_controller simple_exploration_controller
Rviz --> I added to view the path topic from the exploration node, the /slam_out_pose topic from the hector_mapping_node ,the polygon from the robot's footprint from the exploration node, the global costmap from the exploration node and the robot model.
Results:
The path generated at the beginning was correct, but the robot didn't follow it. The robot model in rviz went the other direction, while the actual robot in gazebo moved forward entirely wrong.
the /slam_out_pose was correct and
according to what the robot's pose
was in gazebo.The footprint's polygon marker at the start was where the robot was in gazebo, but after the simulation started it moved in the opposite direction of what the robot was doing in gazebo.
The global costmap was correct.
The robot model in rviz followed the footprint's polygon, while the robot in the simulation was going in another direction.
Because of that lack of coordination between the robot in gazebo and the polygon marker, the robot in gazebo moved forward and crashed into a wall, while in rviz the robot model following the robot's footprint moved backwards, got behind a wall (that it was identified in the costmap) and stopped.
I let the simulation to flow a bit more to see what happened. The robot in gazebo pushed a box/wall which was identified by the lidar and kept moving in various directions. Once, the polygon and the robot in gazebo met, but the bad navigation continued because they separated again.
I cannot find the reason why this happens. In case you need more information or a video to understand the issue please tell me to re-edit my post.
Thank you for answer and your time in advance,
Chris