Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teb tweaking #29

Merged
merged 18 commits into from
Feb 12, 2021
Merged

Teb tweaking #29

merged 18 commits into from
Feb 12, 2021

Conversation

PhileasL
Copy link
Member

Summary

This PR isn't necessary properly apart of odometry_readjustement but in my opinion it's a primordial step before doing more odometry_adjustement. This PR is about tuning the teb_local_planner for nearly optimal value for the cdfr case.

Understanding about teb_local_planner

teb_local_planner is a pretty complex thing in which parameters can be a bit tricky to understand. Here's my observation about theses parameters:

  • min_obstacle_dist: the minimum distance from the footprint to the obstacle for which the trajectory is considered aborted because it "hits" the obstacle. The value here is 0.03m less will cause some unwanted navigation abort.
  • inflation_dist: the inflation radius (in meters) around obstacles, when the cell considered is near the obstacle and in the inflation radius, this cell have an higher cost. 0.25m seems to be a good deal between insurance of avoiding the obstacle and overall shortest time when moving.
  • include_costmap_obstacles: this boolean include the obstacles in the LOCAL_COSTMAP not the global one. So the local_costmap should contains static obstacles.
  • costmap_obstacles_behind_robot_dist: the distance (in meters) which obstacles behind the robot are considered. When moving backward, it's very important to know what's behind the robot, that's why this distance is set to 3.0m.
  • map_frame: set the frame name from which dynamic obstacles positions are considered.
  • include_dynamic_obstacles: A HUGE and very powerful tool from the teb_local_planner explained below.

Dynamic obstacles

teb_local_planner has its own ennemie (dynamic obstacle) prediction system which is amazing. To achieve this, the only thing to do is publish on the /obstacles topic an ObstacleArrayMsg from costmap_converter package which contains the position of the obstacle, its radius and its speed (linear, angular or both). With this message, the teb_local_planner is able to adapt the trajectory computed to avoid the dynamic obstacle considering its movement ! Very powerful tool.

Teb_obstacle node

The goal of this node is doing the thing described in the section above. To achieve this, the node subscribes to /ennemies_positions_markers and /allie_robot/odom to get the position of the robot (with a little transformation in the case of the odom). The node only compute linear speed by comparing the actual position state with the previous stored state and by dividing by the differences between the stamps. Then it simply send the ObstacleArrayMsg to 'obstacles' topic (the namespace is considered, so either /asterix/obstacles or /obelix/obstacles).

In fact, the planner takes care of the global_costmap and the 
teb_local_planner only of the local_costmap. Here, the local_costmap is 
just representing the static map without inflation and gradient_layer 
that need a specific treatement.
- Decreasing controller_frequency which were way too high,
- Made the progress checker more accurate on progress detection,
- Raise of the min_obstacle_distance and inflation radius to avoid 
navigation abort due to trajectory collision with an obstacle,
- Include static costmap obstacles.

Next step: create a node for computing and sending dynamic obstacles to 
teb_local_planner.
The goal of this node is to compute and send to the teb_local_planner 
the dynamic obstacles. With theses obstacles, the teb_local_planner 
might be able to make better decisions. The dynamic obstacles are (for 
the moment in my mind):
- Ennemies
- The other allie
This ObstacleArrayMsg object is the object to send to the topic 
'obstacle' in order to tell the teb_local_planner that theses obstacles 
are dynamic obstacles
The purpose of this dictionnary is to track which marker id of the 
obstaclesArray is at which index in order to update the array instead of 
re-create it in case of new markers detection from assurancetourix
This function dissociate the predicted markers (id > 10) from the true 
positions of the ennemie. 
At first call, it will just put the marker id in a availible slot of the 
dictionary.
Other callbacks will set the dynamic obstacles
Set the position of the obstacle + compute its x and y linear velocity 
for the teb_local_planner in order to predict the movement of the 
dynamic obstacle
By subscribing to the odometry of the allie, we can get the position of 
the allie relative to its odom frame. 
With the odom->map transform, we can have these coordinates in the map 
frame. 
Then we can set the allie dynamic obstacle by the same way as for 
ennemies.
Cooldown of 0.3s between each update of allie dynamic obstacle
@PhileasL PhileasL requested a review from a team February 11, 2021 22:59
Copy link
Member Author

@PhileasL PhileasL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall ok to rebase, juste little tweaks to make it cleaner.

Comment on lines +72 to +73
xy_goal_tolerance: 0.01
yaw_goal_tolerance: 0.01
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little bit of oscillations left in some cases, majoritary xy oscillations. Maybe raise thoses numbers and finish the movement by a dedicated precision and very slow navigation custom plugin should be a good idea.

Comment on lines +167 to +179
gradient_layer: #draw radians circle around ennemies
plugin: "gradient_costmap_layer_plugin/GradientLayer"
enabled: false
gradient_size: 7
gradient_factor: 100
markers_topic: /ennemies_positions_markers
inflation_layer:
plugin: nav2_costmap_2d::InflationLayer
enabled: false
inflation_radius: 0.01
cost_scaling_factor: 5.0
inflate_unknown: false
inflate_around_unknown: false
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering theses plugins disabled, it might be cleaner to remove them.


self.obstacles_publisher_ = self.create_publisher(ObstacleArrayMsg, 'obstacles', 10)

self.dictionary_index_id = {"0":0, "1":0, "2":0}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"0" key is not used is the rest of the node. Removing it may be a good idea but some parts of the node have to be reworked in order to achieve it.

@PhileasL PhileasL merged commit df97f05 into odometry_readjustement Feb 12, 2021
@PhileasL
Copy link
Member Author

For the future maybe consider also angular velocities in the teb_obstacles node.

@PhileasL PhileasL deleted the teb_tweaking branch February 12, 2021 09:13
@PhileasL PhileasL mentioned this pull request Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant