Giter Club home page Giter Club logo

grad_traj_optimization's Introduction

GTOP:Gradient-Based Trajectory Optimizer

(This repo is mainly developed and maintained by Boyu Zhou, please contace him if necessary)

1.Introduction

Gradient-Based Online Safe Trajectory Generation is trajectory optimization framework, for generating a safe, smooth and dynamically feasible trajectory based on the piecewise line segment initial path. The planning problem is formulating as minimizing the penalty of collision cost, smoothness and dynamical feasibility.

Authors:Fei Gao,Boyu Zhou,and Shaojie Shen from the HUKST Aerial Robotics Group.

Disclaimer

This is research code, any fitness for a particular purpose is disclaimed.

Related Paper

  • Gradient-Based Online Safe Trajectory Generation for Quadrotor Flight in Complex Environments, Fei Gao, Yi Lin and Shaojie Shen

Video of this paper can be found here.

         

If you use this generator for your academic research, please cite our related paper.

@inproceedings{Fei2017IROS,
	Address = {Vancouver, Canada},
	Author = {F. Gao and W.Wu and Y. Lin and S. Shen},
	Booktitle = {Gradient-Based Online Safe Trajectory Generation
for Quadrotor Flight in Complex Environments},
	Title = {Proc. of the {IEEE/RSJ} Intl. Conf. on Intell. Robots and Syst.},
	Month = Sept.,
	Year = {2017}}
}

2.Prerequisities

Our testing environment: Ubuntu 14.04, ROS Indigo.

We use NLopt as optimization solver. Installation is straight forward. Just download, extract and compile:

mkdir build
cd build
cmake ..
make

Finally you should install it.

sudo make install

Detailed information can be found here.

Note:The default installation prefix of NLopt is /usr/local

3.Build on ROS

Clone the repository to your catkin workspace and catkin_make. For example:

  cd ~/catkin_ws/src
  git clone https://github.com/HKUST-Aerial-Robotics/grad_traj_optimization.git
  cd ../
  catkin_make
  source ~/catkin_ws/devel/setup.bash

4.Random Map and Waypoints Example

Open two terminals and run:

  roslaunch grad_traj_optimization traj_rviz.launch
  roslaunch grad_traj_optimization random.launch

After running and open rviz with traj.rviz file, you should find a randomly built collision map with some waypoints going through it. Then a smooth and collision free trajectory is generated.

5.Random Map and Clicked Waypoints Example

Similarly, run:

  roslaunch grad_traj_optimization traj_rviz.launch
  roslaunch grad_traj_optimization click.launch

Likewise, a random collision map is built but with fewer obstacles. Then you can click in rviz using 2D Nav Goal to add some waypoints. The Z coordinate of each waypoint is set to 2.0. The default waypoint number is 7 and you can change it in click.launch. Trajectory is generated as long as enough waypoints are added.

Note:Trajectory with too many segments or with sharp corner is difficult to optimized and is tend to fail.

6.Text Input Example

If you want to set the collision map and waypoints as much as you like, run

  roslaunch grad_traj_optimization traj_rviz.launch
  roslaunch grad_traj_optimization text_input.launch

Instead of randomly generated ,the collision map and waypoints in this example is specified in text_input.launch.Just change it to what you want.

7.Acknowledgements

We use NLopt for non-linear optimization and sdf_tools for building signed distance field.

8.Licence

The source code is released under GPLv3 license.

grad_traj_optimization's People

Contributors

ustfgaoaa avatar zbylgsc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grad_traj_optimization's Issues

some error occured when performing catkin_make

Hi Gao,
Sorry to bother you, I have encountered the following problem, when i did the 'catkin_make -j1'.I use
ubunut14.04 \indigo \libboost1.54-dev.


Built target sdf_tools_generate_messages
[ 57%] Built target test_arc_utilities
[ 60%] Built target test_hierarchical_clustering
[ 63%] Building CXX object grad_traj_optimization/third_party/sdf_tools/CMakeFiles/sdf_tools.dir/src/sdf_tools/sdf.cpp.o
/home/relaybot/catkin_s0/src/grad_traj_optimization/third_party/sdf_tools/src/sdf_tools/sdf.cpp: In member function ‘double sdf_tools::SignedDistanceField::EstimateDistanceInternal(double, double, double, int64_t, int64_t, int64_t) const’:
/home/relaybot/catkin_s0/src/grad_traj_optimization/third_party/sdf_tools/src/sdf_tools/sdf.cpp:554:99: error: operands to ?: have different types ‘const Eigen::CwiseUnaryOp<Eigen::internal::scalar_opposite_op, const Eigen::Matrix<double, 3, 1> >’ and ‘const Vector3d {aka const Eigen::Matrix<double, 3, 1>}’
const Eigen::Vector3d direction_to_boundary = (nominal_sdf_distance >= 0.0) ? -gradient : gradient;
^
make[2]: *** [grad_traj_optimization/third_party/sdf_tools/CMakeFiles/sdf_tools.dir/src/sdf_tools/sdf.cpp.o] Error 1
make[1]: *** [grad_traj_optimization/third_party/sdf_tools/CMakeFiles/sdf_tools.dir/all] Error 2
make: *** [all] Error 2
Invoking "make -j3 -l3" failed
relaybot@ubuntu:~/catkin_s0$

Find a bug for calculating collision gradient

Thank you for your good job in path optimization, and release your research, but i may find some bug in your implements.

here, V must be setzero, if not,

g_colli.row(k) = g_colli.row(k) + (gd * grad(k) * cd * vel_norm * T * Ldp +
can be a random values in some place, please check and fix it!

Trajectory inconsistent with the demonstration?

I compile the code in ubuntu 20.04 with NLopt 2.7.1. However, the trajectory generated by running roslaunch grad_traj_optimization text_input.launch looks like:

Screenshot from 2023-05-29 22-14-29
and is inconsistent with the demonstration. Does anyone meet the same problem?
Thanks!

have solved:
I modified the params in text_input.launch to be same with random.launch and looks no problems, thanks!

Integration with octomap

Hi,
Thanks for sharing the nice code.
I wonder do you have any suggestion how to integrate it with octomap?

Many thanks.

Kind Regards,
Chang

Todo Reminder ::

I think now this repo needs a significant update. Includes but not limited with:

  1. Get rid of the clumsy sdf_tools (too long building time). Replace it with our new lightweight sdf package.
  2. Re-factor the interface. Make it can be used as a clean optimizer.
  3. Clean duplicate parameters. Delete all hard-coded codes.

Final trajectory has collision with the obstacle

We test your code and compare it with your paper, [Gradient-Based Online Safe Trajectory for Quadrotor Flight in Complex Environments]. We have some questions about your project.

First, in your paper V-C, you mentioned that you first optimize the collision cost only. All the free variables will be pushed to the basin of the distance field from the neighborhood of obstacles. Then re-allocate the time and re-parameterize the trajectory to time according to current waypoints' postion.
Although, we found in your code. The first-setp optimize the trajectory's smooth and obstacle.The second-step optimize obstacles, trajectory's smooth, velocity and acceleration, which conflict with your paper work. We guess it is why sometime the final trajectory would have collision with the obstacles.

_20171221170940

Second, sometimes the demo random would terminate like the image show below. There is some bug maybe?

_20171221170945

@ZbyLGsc

catkin_make failed

Hi Gao,

I was trying to build GTOP on my own PC, but it seems that something wrong happened with building. Would you mind helping me fix with it?

Look forward to your reply.

image

It might be a mistake in calculating collision gradient

Thank you for your good job! Here I have a question of your implements. It might be a mistake in lines 649-657 of the grad_traj_optimizer.h ?

// ------------------------ gradient of collision cost------------------------
{
  for(int k = 0; k < 3; k++)
  {
    g_colli.row(k) = g_colli.row(k) + (gd * grad(k) * cd * vel_norm * T * Ldp +
                                       cd * (vel(k) / vel_norm) * T * V * Ldp) *
                                          dt;
  }
}

From the paper $∇_μ c ( p ( T_k ) )‖v‖F$, it seems that "cd" should be deleted in gd * grad(k) * cd * vel_norm * T * Ldp:

// ------------------------ gradient of collision cost------------------------
{
  for(int k = 0; k < 3; k++)
  {
    g_colli.row(k) = g_colli.row(k) + (gd * grad(k) * vel_norm * T * Ldp +
                                       cd * (vel(k) / vel_norm) * T * V * Ldp) *
                                          dt;
  }
}

Thank you for your response!

Is it possible to collide obstacles during optimization?

Hi, thank you very much for release the code, it is really helpful. Here is my problem.
When I am running a case using a cylinder obstacle and I set several waypoints around the cylinder.

Here is the initial trajectory. There is no collision.
Screenshot from 2020-09-16 21-16-23

Here is the trajectory after first step optimization, and there is no collision too.
Screenshot from 2020-09-16 21-20-07

While after second step optimization, the trajectory has collision with the obstacle.
Screenshot from 2020-09-16 21-21-55

Is it possible to have such a condition? Or it is because I am using some wrong parameters. Thank you very much for your time.

fixed a problem about libnlopt and rvizplugins

problem 1:

launch rviz and get errors like“lack goal3D tools"
Fixed:
get rviz plugin package somewhere and add it as a package into the workspace ,catkin_make again.source and roslaunch

problem 2:

roslaunch grad_traj_optimization random.launch
but get errors like

error while loading shared libraries: libnlopt.so.0: cannot open shared object file: No such file or directory

fixed:
sudo apt-get install libnlopt0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.