ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

smac lattice planner for differential robot

asked 2022-12-21 20:24:09 -0600

Youssef_Lah gravatar image

updated 2022-12-21 20:29:39 -0600

env: ros2 humble on ubuntu 22.04

I am trying to use smac lattice planner for my differential/rectangular robot. I noticed that when the robot arrives near goal, it parks as a vehicle and it does not rotate on goal. in nav2 documentation it says that the planner is suitable for differential non-circular robot. How can I make the robot rotate on goal ? here is the screen and config:

image description

    expected_planner_frequency: 20.0
    use_sim_time: False
    planner_plugins: ["GridBased"]
      plugin: "nav2_smac_planner/SmacPlannerLattice"
      allow_unknown: true  
      tolerance: 0.05
      max_iterations: 1000000         
      max_on_approach_iterations: 1000  
      max_planning_time: 5.0          
      analytic_expansion_ratio: 3.5 
      analytic_expansion_max_length: 4.0 
      reverse_penalty: 1.0 
      change_penalty: 0.05 
      non_straight_penalty: 1.05
      cost_penalty: 2.0
      rotation_penalty: 1.0               
      retrospective_penalty: 0.015
      lattice_filepath: "path_to_file/output.json" 
      lookup_table_size: 20.0  
      cache_obstacle_heuristic: true
      allow_reverse_expansion: true
      smooth_path: False

and for the primitive config:

    "motion_model": "diff",
    "turning_radius": 1.0,
    "grid_resolution": 0.05,
    "stopping_threshold": 5,
    "num_of_headings": 16
edit retag flag offensive close merge delete


You don't seem to be distinguishing between a Planner and a Controller. Do you think the problem is that the Planner is not generating the pose you want, or that the Controller is not executing it?

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-12-24 08:45:49 -0600 )edit

the controller is following the exact path (as expected), but the generated path from the planner is not suitable for differential robot since differential robots can rotate in place, but if you see the screenshot, the robot will park as a vehicle to meet the requested orientation.

Youssef_Lah gravatar image Youssef_Lah  ( 2022-12-28 12:15:31 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2022-12-21 23:14:08 -0600

"turning_radius" would be the first suspect I would check out. Right now it is set to 1 meter, which is consistent with the radius of the "turn maneuver" towards the end of the path you posted.

Have you tried to set the turning radius parameter to 0? (Which I assume it should enable "in place turn" for your differential robot)

edit flag offensive delete link more


when I set it to 0, the robot arrive to goal and stops, it does not rotate to meet the desired orientation.

Youssef_Lah gravatar image Youssef_Lah  ( 2022-12-28 12:17:04 -0600 )edit

You should checkout this and make sure that your minimum control set contains in-place rotations. Another thing I would try is to lower the rotation_penalty to maybe 0.1 or 0.01 even, and see what happens

Martin Peris gravatar image Martin Peris  ( 2023-01-18 23:30:25 -0600 )edit

the minimum turning_radius value that I can set to generate the lattice file is 0.08, else the script got division by zero error, so I set it to 0.08 and I lowered the rotation_penalty and it worked. Thank you Martin.

Youssef_Lah gravatar image Youssef_Lah  ( 2023-01-26 19:44:34 -0600 )edit

Question Tools

1 follower


Asked: 2022-12-21 20:24:09 -0600

Seen: 114 times

Last updated: Dec 21 '22