Skip to content

Commit

Permalink
Merge branch 'melodic-devel' into fix-stuck-in-local-minimum
Browse files Browse the repository at this point in the history
  • Loading branch information
amakarow authored Oct 17, 2020
2 parents f9d88b0 + e38e88e commit 1981d35
Show file tree
Hide file tree
Showing 25 changed files with 941 additions and 525 deletions.
65 changes: 38 additions & 27 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,32 @@
Changelog for package teb_local_planner
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.6.14 (2019-10-25)
-------------------
* Rename variable instead of scoping it's usage
0.8.4 (2019-12-02)
------------------
* Fixed TEB autoResize if last TimeDiff is small
* Add a rotational threshold for identifying a warm start goal
* Contributors: Rainer Kümmerle

0.8.3 (2019-10-25)
------------------
* Limiting the control look-ahead pose to the first that execeeds the expected look-ahead time (thanks to Marco Bassa)
* test_optim_node fix circular obstacles (thanks to dtaranta)
* Fix shadow variable warning (thanks to Victor Lopez)
* Use SYSTEM when including external dependencies headers (thanks to Victor Lopez)
* Limiting the control look-ahead pose to the first that execeeds the expected look-ahead time (thanks to Marco Bassa)
* Robustify initTrajectoryToGoal if a plan is given (thanks to Rainer Kuemmerle)
* Adding the option to shift ahead the target pose used to extract the velocity command (thanks to Marco Bassa)
* Fixed segfault in optimal_planner.cpp when clearing graph with unallocated optimizer.
Fixes `#158 <https://github.com/rst-tu-dortmund/teb_local_planner/issues/158>`_.
* Added warning if parameter optimal_time is <= 0
* On footprintCost, fail only if footprint is in collision, not outside the map or on unknown space (thanks to corot)
* Native MoveBaseFlex support added: Implements both nav_core::BaseLocalPlanner and mbf_costmap_core::CostmapController abstract interfaces (thanks to corot)
* added warning if parameter optimal_time is <= 0
* Nonlinear obstacle cost from EdgeInflatedObstacle also added to EdgeObstacle.
See `#140 <https://github.com/rst-tu-dortmund/teb_local_planner/issues/140>`_.
* Fixed proper initialization of parameter obstacle_cost_exponent in case it is not loaded from the parameter server
* Contributors: Christoph Rösmann, Marco Bassa, Victor Lopez, dtaranta

0.6.13 (2019-07-01)
-------------------
* Avoiding h signature interpolation between coincident poses (thanks to Marco Bassa)
* New strategy for the deletion of detours: Detours are now determined w.r.t. the least-cost alternative and not w.r.t. just the goal heading.
Deletion of additional alternatives applies if either an initial backward motion is detected, if the transition time is much bigger than the duration of the best teb
and if a teb cannot be optimized (thanks to Marco Bassa).
Optionally allowing the usage of the initial plan orientation when initializing new tebs.
* Contributors: Christoph Rösmann, Marco Bassa

0.6.12 (2019-06-21)
-------------------
* Contributors: Christoph Rösmann, Marco Bassa, Rainer Kuemmerle, Victor Lopez, corot, dtaranta

0.8.2 (2019-07-02)
------------------
* Allow scripts to be executable and usable by rosrun after catkin_make install and through the catkin release process (thanks to Devon Ash)
* Add nonlinear part to obstacle cost to improve narrow gap behavior.
Parameter `obstacle_cost_exponent` defines the exponent of the nonlinear cost term.
Expand All @@ -52,16 +50,29 @@ Changelog for package teb_local_planner
* Changed isTrajectoryFeasible function to allow for a more accurate linear and angular discretization (thanks to Marco Bassa)
* Function TebOptimalPlanner::computeError() considers now the actual optimizer weights.
As a result, the default value of `selection_obst_cost_scale` is reduced (thanks to Howard Cochran).
* Contributors: Christoph Rösmann, Devon Ash, Howard Cochran, Marco Bassa, ShiquLIU, Tobi Loew, corot
* update to use non deprecated pluginlib macro (thanks to Mikael Arguedas)
* Avoiding h signature interpolation between coincident poses (thanks to Marco Bassa)
* New strategy for the deletion of detours: Detours are now determined w.r.t. the least-cost alternative and not w.r.t. just the goal heading.
Deletion of additional alternatives applies if either an initial backward motion is detected, if the transition time is much bigger than the duration of the best teb
and if a teb cannot be optimized (thanks to Marco Bassa).
Optionally allowing the usage of the initial plan orientation when initializing new tebs.
* Contributors: Christoph Rösmann, Mikael Arguedas, Devon Ash, Howard Cochran, Marco Bassa, ShiquLIU, Tobi Loew, corot

0.6.11 (2018-08-14)
-------------------
* bugfix in calculateHSignature. Fixes #90.
0.8.1 (2018-08-14)
------------------
* bugfix in calculateHSignature. Fixes `#90 <https://github.com/rst-tu-dortmund/teb_local_planner/issues/90>`_.
* fixed centroid computation in a special case of polygon-obstacles
* Contributors: Christoph Rösmann

0.6.10 (2018-07-05)
-------------------
0.8.0 (2018-08-06)
------------------
* First melodic release
* Updated to new g2o API
* Migration to tf2
* Contributors: Christoph Rösmann

0.7.3 (2018-07-05)
------------------
* Parameter `switching_blocking_period` added to homotopy class planner parameter group.
Values greater than zero enforce the homotopy class planner to only switch to new equivalence classes as soon
as the given period is expired (this might reduce oscillations in some scenarios). The value is set to zero seconds
Expand All @@ -82,15 +93,15 @@ Changelog for package teb_local_planner
* dynamic_reconfigure: parameter visualize_with_time_as_z_axis_scale moved to group trajectory
* Contributors: Christoph Rösmann

0.6.9 (2018-06-08)
0.7.2 (2018-06-08)
------------------
* Adds the possibility to provide via-points via a topic.
Currently, the user needs to decide whether to receive via-points from topic or to obtain them from the global reference plan
(e.g., activate the latter by setting global_plan_viapoint_sep>0 as before).
A small test script publish_viapoints.py is provided to demonstrate the feature within test_optim_node.
* Contributors: Christoph Rösmann

0.6.8 (2018-06-05)
0.7.1 (2018-06-05)
------------------
* Fixed a crucial bug (from 0.6.6): A cost function for prefering a clockwise resp. anti-clockwise turn was enabled by default.
This cost function was only intended to be active only for recovering from an oscillating robot.
Expand All @@ -105,7 +116,7 @@ Changelog for package teb_local_planner
* Normalize marker quaternions in *test_optim_node*
* Contributors: Christoph Rösmann, Alexander Reimann, Mikael Arguedas, wollip

0.6.7 (2017-09-21)
0.7.0 (2017-09-23)
------------------
* This update introduces support for dynamic obstacles (thanks to Franz Albers, who implemented and tested the code).
Dynamic obstacle support requires parameter *include\_dynamic\_obstacles* to be activated.
Expand Down
19 changes: 15 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ find_package(catkin REQUIRED COMPONENTS
message_generation
nav_core
nav_msgs
mbf_costmap_core
mbf_msgs
roscpp
std_msgs
pluginlib
tf
tf_conversions
tf2
tf2_eigen
tf2_geometry_msgs
tf2_ros
visualization_msgs
)
message(STATUS "System: ${CMAKE_SYSTEM}")
Expand Down Expand Up @@ -156,8 +160,8 @@ catkin_package(
pluginlib
roscpp
std_msgs
tf
tf_conversions
tf2
tf2_ros
visualization_msgs
DEPENDS SUITESPARSE G2O
)
Expand Down Expand Up @@ -263,6 +267,13 @@ install(DIRECTORY
## Testing ##
#############

if (CATKIN_ENABLE_TESTING)
catkin_add_gtest(test_teb_basics test/teb_basics.cpp)
if(TARGET test_teb_basics)
target_link_libraries(test_teb_basics teb_local_planner)
endif()
endif()

## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME}-test test/test_teb_local_planner.cpp)
# if(TARGET ${PROJECT_NAME}-test)
Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ separation from obstacles and compliance with kinodynamic constraints at runtime

Refer to http://wiki.ros.org/teb_local_planner for more information and tutorials.

Build status of the *kinetic-devel* branch:
- ROS Buildfarm (Kinetic): [![Kinetic Status](http://build.ros.org/buildStatus/icon?job=Kdev__teb_local_planner__ubuntu_xenial_amd64)](http://build.ros.org/job/Kdev__teb_local_planner__ubuntu_xenial_amd64/)
Build status of the *melodic-devel* branch:
- ROS Buildfarm (Melodic): [![Melodic Status](http://build.ros.org/buildStatus/icon?job=Mdev__teb_local_planner__ubuntu_bionic_amd64)](http://build.ros.org/job/Mdev__teb_local_planner__ubuntu_bionic_amd64/)


### Papers Describing the Approach
## Citing the Software

*Since a lot of time and effort has gone into the development, please cite at least one of the following publications if you are using the planner for your own research:*

Expand All @@ -21,7 +21,9 @@ Build status of the *kinetic-devel* branch:
- C. Rösmann, F. Hoffmann and T. Bertram: Planning of Multiple Robot Trajectories in Distinctive Topologies, Proc. IEEE European Conference on Mobile Robots, UK, Lincoln, Sept. 2015.
- C. Rösmann, F. Hoffmann and T. Bertram: Kinodynamic Trajectory Optimization and Control for Car-Like Robots, IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), Vancouver, BC, Canada, Sept. 2017.

### Videos
<a href="https://www.buymeacoffee.com/croesmann" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/lato-black.png" alt="Buy Me A Coffee" height="31px" width="132px" ></a>

## Videos

The left of the following videos presents features of the package and shows examples from simulation and real robot situations.
Some spoken explanations are included in the audio track of the video.
Expand All @@ -32,7 +34,7 @@ alt="teb_local_planner - An Optimal Trajectory Planner for Mobile Robots" width=
<a href="http://www.youtube.com/watch?feature=player_embedded&v=o5wnRCzdUMo" target="_blank"><img src="http://img.youtube.com/vi/o5wnRCzdUMo/0.jpg"
alt="teb_local_planner - Car-like Robots and Costmap Conversion" width="240" height="180" border="10" /></a>

### License
## License

The *teb_local_planner* package is licensed under the BSD license.
It depends on other ROS packages, which are listed in the package.xml. They are also BSD licensed.
Expand All @@ -45,7 +47,7 @@ Some third-party dependencies are included that are licensed under different ter

All packages included are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the licenses for more details.

### Requirements
## Requirements

Install dependencies (listed in the *package.xml* and *CMakeLists.txt* file) using *rosdep*:

Expand Down
30 changes: 28 additions & 2 deletions cfg/TebLocalPlannerReconfigure.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ grp_trajectory.add("max_global_plan_lookahead_dist", double_t, 0,

grp_trajectory.add("force_reinit_new_goal_dist", double_t, 0,
"Force the planner to reinitialize the trajectory if a previous goal is updated with a seperation of more than the specified value in meters (skip hot-starting)",
1.0, 0.0, 10.0)
1.0, 0.0, 10.0)

grp_trajectory.add("force_reinit_new_goal_angular", double_t, 0,
"Force the planner to reinitialize the trajectory if a previous goal is updated with a rotational difference of more than the specified value in radians (skip hot-starting)",
0.78, 0.0, 4.0)

grp_trajectory.add("feasibility_check_no_poses", int_t, 0,
"Specify up to which pose on the predicted plan the feasibility should be checked each sampling interval",
Expand Down Expand Up @@ -100,6 +104,10 @@ grp_robot.add("is_footprint_dynamic", bool_t, 0,
"If true, updated the footprint before checking trajectory feasibility",
False)

grp_robot.add("use_proportional_saturation", bool_t, 0,
"If true, reduce all twists components (linear x and y, and angular z) proportionally if any exceed its corresponding bounds, instead of saturating each one individually",
False)

# Robot/Carlike

grp_robot_carlike = grp_robot.add_group("Carlike", type="hide")
Expand Down Expand Up @@ -185,7 +193,21 @@ grp_obstacles.add("costmap_obstacles_behind_robot_dist", double_t, 0,
grp_obstacles.add("obstacle_poses_affected", int_t, 0,
"The obstacle position is attached to the closest pose on the trajectory to reduce computational effort, but take a number of neighbors into account as well",
30, 0, 200)


# Obstacle - Velocity ratio parameters
grp_obstacles_velocity_limit = grp_obstacles.add_group("Reduce velocity near obstacles")

grp_obstacles_velocity_limit.add("obstacle_proximity_ratio_max_vel", double_t, 0,
"Ratio of the maximum velocities used as an upper bound when reducing the speed due to the proximity to static obstacles",
1, 0, 1)

grp_obstacles_velocity_limit.add("obstacle_proximity_lower_bound", double_t, 0,
"Distance to a static obstacle for which the velocity should be lower",
0, 0, 10)

grp_obstacles_velocity_limit.add("obstacle_proximity_upper_bound", double_t, 0,
"Distance to a static obstacle for which the velocity should be higher",
0.5, 0, 10)

# Optimization
grp_optimization = gen.add_group("Optimization", type="tab")
Expand Down Expand Up @@ -270,6 +292,10 @@ grp_optimization.add("weight_dynamic_obstacle_inflation", double_t, 0,
"Optimization weight for the inflation penalty of dynamic obstacles (should be small)",
0.1, 0, 10)

grp_optimization.add("weight_velocity_obstacle_ratio", double_t, 0,
"Optimization weight for satisfying a maximum allowed velocity with respect to the distance to a static obstacle",
0, 0, 1000)

grp_optimization.add("weight_viapoint", double_t, 0,
"Optimization weight for minimizing the distance to via-points",
1, 0, 1000)
Expand Down
123 changes: 123 additions & 0 deletions include/teb_local_planner/g2o_types/edge_velocity_obstacle_ratio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#pragma once


#include <teb_local_planner/optimal_planner.h>


namespace teb_local_planner
{


/**
* @class EdgeVelocityObstacleRatio
* @brief Edge defining the cost function for keeping a minimum distance from obstacles.
*
* The edge depends on a single vertex \f$ \mathbf{s}_i \f$ and minimizes: \n
* \f$ \min \textrm{penaltyBelow}( dist2point ) \cdot weight \f$. \n
* \e dist2point denotes the minimum distance to the point obstacle. \n
* \e weight can be set using setInformation(). \n
* \e penaltyBelow denotes the penalty function, see penaltyBoundFromBelow() \n
* @see TebOptimalPlanner::AddEdgesObstacles, TebOptimalPlanner::EdgeInflatedObstacle
* @remarks Do not forget to call setTebConfig() and setObstacle()
*/
class EdgeVelocityObstacleRatio : public BaseTebMultiEdge<2, const Obstacle*>
{
public:

/**
* @brief Construct edge.
*/
EdgeVelocityObstacleRatio() :
robot_model_(nullptr)
{
// The three vertices are two poses and one time difference
this->resize(3); // Since we derive from a g2o::BaseMultiEdge, set the desired number of vertices
}

/**
* @brief Actual cost function
*/
void computeError()
{
ROS_ASSERT_MSG(cfg_ && _measurement && robot_model_, "You must call setTebConfig(), setObstacle() and setRobotModel() on EdgeVelocityObstacleRatio()");
const VertexPose* conf1 = static_cast<const VertexPose*>(_vertices[0]);
const VertexPose* conf2 = static_cast<const VertexPose*>(_vertices[1]);
const VertexTimeDiff* deltaT = static_cast<const VertexTimeDiff*>(_vertices[2]);

const Eigen::Vector2d deltaS = conf2->estimate().position() - conf1->estimate().position();

double dist = deltaS.norm();
const double angle_diff = g2o::normalize_theta(conf2->theta() - conf1->theta());
if (cfg_->trajectory.exact_arc_length && angle_diff != 0)
{
double radius = dist/(2*sin(angle_diff/2));
dist = fabs( angle_diff * radius ); // actual arg length!
}
double vel = dist / deltaT->estimate();

vel *= fast_sigmoid( 100 * (deltaS.x()*cos(conf1->theta()) + deltaS.y()*sin(conf1->theta())) ); // consider direction

const double omega = angle_diff / deltaT->estimate();

double dist_to_obstacle = robot_model_->calculateDistance(conf1->pose(), _measurement);

double ratio;
if (dist_to_obstacle < cfg_->obstacles.obstacle_proximity_lower_bound)
ratio = 0;
else if (dist_to_obstacle > cfg_->obstacles.obstacle_proximity_upper_bound)
ratio = 1;
else
ratio = (dist_to_obstacle - cfg_->obstacles.obstacle_proximity_lower_bound) /
(cfg_->obstacles.obstacle_proximity_upper_bound - cfg_->obstacles.obstacle_proximity_lower_bound);
ratio *= cfg_->obstacles.obstacle_proximity_ratio_max_vel;

const double max_vel_fwd = ratio * cfg_->robot.max_vel_x;
const double max_omega = ratio * cfg_->robot.max_vel_theta;
_error[0] = penaltyBoundToInterval(vel, max_vel_fwd, 0);
_error[1] = penaltyBoundToInterval(omega, max_omega, 0);

ROS_ASSERT_MSG(std::isfinite(_error[0]) || std::isfinite(_error[1]), "EdgeVelocityObstacleRatio::computeError() _error[0]=%f , _error[1]=%f\n",_error[0],_error[1]);
}

/**
* @brief Set pointer to associated obstacle for the underlying cost function
* @param obstacle 2D position vector containing the position of the obstacle
*/
void setObstacle(const Obstacle* obstacle)
{
_measurement = obstacle;
}

/**
* @brief Set pointer to the robot model
* @param robot_model Robot model required for distance calculation
*/
void setRobotModel(const BaseRobotFootprintModel* robot_model)
{
robot_model_ = robot_model;
}

/**
* @brief Set all parameters at once
* @param cfg TebConfig class
* @param robot_model Robot model required for distance calculation
* @param obstacle 2D position vector containing the position of the obstacle
*/
void setParameters(const TebConfig& cfg, const BaseRobotFootprintModel* robot_model, const Obstacle* obstacle)
{
cfg_ = &cfg;
robot_model_ = robot_model;
_measurement = obstacle;
}

protected:

const BaseRobotFootprintModel* robot_model_; //!< Store pointer to robot_model

public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW

};


} // end namespace
Loading

0 comments on commit 1981d35

Please sign in to comment.