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

Add trajopt_ifopt and trajopt_sqp #116

Merged
merged 27 commits into from
May 27, 2020

Conversation

mpowelson
Copy link
Contributor

@mpowelson mpowelson commented Jul 22, 2019

This PR will add costs and constraints using IFOPT as a generic solver interface. This will allow the usage of solvers such as IPOPT, SNOPT, Pagmo, and others.

Costs/Constraints

Currently Supported Constraints :

  • Joint Position
  • Joint Velocity
  • Cartesian Position(FK)
  • Inverse Kinematics

Currently Supported Costs (converts any constraint into a cost)

  • Squared Cost

Solvers

Additionally, the SQP solver has been rewritten. Currently it provides the SQP routine with interfaces to these QP solvers

Therefore the solvers that will work in this new framework are

Breaking Changes

  • IFOPT has been added to rosinstall. While it is released on the ROS build farm, this currently needs some changes that have not been released yet.

@mpowelson
Copy link
Contributor Author

@Levi-Armstrong Could you take a quick look at this? I've got joint position variables and joint position constraint. Mostly I'd like to make sure I'm not doing something blatantly wrong, have the cmake set up correctly, have tests set up correctly, etc.

@mpowelson mpowelson force-pushed the feature/ifopt branch 2 times, most recently from 4e3c781 to f9af683 Compare July 22, 2019 18:35
Adds the trajopt IFOPT package. Includes joint position and velocity constraints as well as the squared error cost. Includes 2 small examples of usage with IPOPT
@mpowelson
Copy link
Contributor Author

@Levi-Armstrong I think this is probably all of the costs/cnts I will do for now. I'll transition to working on the solver interface now.

trajopt_ifopt/CMakeLists.txt Outdated Show resolved Hide resolved
trajopt_ifopt/CMakeLists.txt Outdated Show resolved Hide resolved
trajopt_ifopt/package.xml Show resolved Hide resolved
trajopt_ifopt/src/cartesian_position_constraint.cpp Outdated Show resolved Hide resolved
trajopt_ifopt/src/cartesian_position_constraint.cpp Outdated Show resolved Hide resolved
trajopt_ifopt/src/collision_constraint.cpp Show resolved Hide resolved
trajopt_ifopt/src/joint_velocity_constraint.cpp Outdated Show resolved Hide resolved
mpowelson added 4 commits May 6, 2020 18:05
I added these methods to make them easier to call without an IFOPT problem. The joint terms didn't seem to make a lot of sense because they operate on multiple ifopt variables.
The old method solved a QP to get a feasible point, but that could sometimes change the starting point from the one passed in.
Adds a flag to the SQP optimizer and the OSQP interface. If both are true, then it prints all SQP Results, writes the model to a file in a human readable format, and prints the optimizer matrices to the terminal.
mpowelson added 3 commits May 15, 2020 15:07
These are necessary since the callbacks are divided up now and not associated with the cost terms themselves. To replicate trajopt_sco behavior add a clear plotter callback, then the cost term callbacks, and finally the wait for input.
@mpowelson
Copy link
Contributor Author

@Levi-Armstrong You don't have any problems with the new code in this PR being Apache 2 do you? I was going to add the notices.

@Levi-Armstrong
Copy link
Contributor

Nope. That is the preferred license.

@mpowelson mpowelson changed the title WIP: Feature/ifopt Feature/ifopt May 18, 2020
@mpowelson mpowelson changed the title Feature/ifopt Add trajopt_ifopt and trajopt_sqp May 18, 2020
@mpowelson
Copy link
Contributor Author

@Levi-Armstrong I think this is ready for you to review.

Disclaimers

  • I've got some TODOs in the trajopt_ifopt readme.
  • Also, the OSQPEigen solver interface still needs some work as well. I'm just calling the solver directly in TrustRegionSQP instead of using the base class. I've got a branch where I am working on that, but since this is functional, I think getting this in is probably more important.

Copy link
Contributor

@Levi-Armstrong Levi-Armstrong left a comment

Choose a reason for hiding this comment

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

I have reviewed half of the files. In addition to the provided comments it looks like the tests withing trajopt_ifopt is missing license information.

trajopt/CMakeLists.txt Show resolved Hide resolved
dependencies.rosinstall Outdated Show resolved Hide resolved
trajopt_ext/osqp_eigen/package.xml Outdated Show resolved Hide resolved
trajopt_ifopt/cmake/trajopt_ifopt-config.cmake.in Outdated Show resolved Hide resolved
trajopt_ifopt/test/CMakeLists.txt Outdated Show resolved Hide resolved
trajopt_ifopt/test/CMakeLists.txt Show resolved Hide resolved
@mpowelson
Copy link
Contributor Author

@Levi-Armstrong This is ready for another look.

Copy link
Contributor

@Levi-Armstrong Levi-Armstrong left a comment

Choose a reason for hiding this comment

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

Minor changes.

@mpowelson
Copy link
Contributor Author

@Levi-Armstrong Addressed the new round of comments

@mpowelson
Copy link
Contributor Author

Sorry. Forgot to run clang-format. Now it is ready.

This includes cleaning up the OSQPEigenSolver interface and a lot of style changes.
@mpowelson
Copy link
Contributor Author

Squashed the last 3 commits now that you have looked at it.

@Levi-Armstrong
Copy link
Contributor

I will merge once CI passes.

@Levi-Armstrong Levi-Armstrong merged commit 85e8d41 into tesseract-robotics:master May 27, 2020
@mpowelson mpowelson deleted the feature/ifopt branch May 27, 2020 17:53
@mpowelson
Copy link
Contributor Author

We will have to add ifopt to any downstream packages' rosinstalls.

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.

2 participants