forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include all the commits I made back from Nov 16th.
This topic branch add the following features to drake 1. Add a new type of constraint, the SingleTimeLinearPostureConstraint. This constraint specifies lb<=A*q<=ub. Also inverseKin,inverseKinPointwise,inverseKinTraj support this constraint type, but not the approximateIK. 2. All IK functions now have a separate C++ interface, so they do not need to be called through MATLAB. Also they have the C++ test files, built in pod-build/bin 3. All constraints can be constructed from the same function, constructRigidBodyConstraint. Each non-abstract constraint has a unique constraint type. 4. I add constness to the methods in RigidBodyConstraint. 5. URDFRigidBodyManipulator now add joint limits and masses to its field. But URDFRigidBodyManipular and RigidBodyManipulator in MATLAB are not exactly the same for the same URDF file. The former one sort the link and joint names, so the link/joint index are different from the MATLAB counterpart. 6. Add findLinkInd method in C++ RigidBodyManipulator. But I am not handling the regular expressions, as does in the MATLAB counterpart. 7. Changed the definition of 'tol' in the WorldQuatConstraint. Previously it was sin(theta/2)^2, where theta is the allowable angle to rotate. This definition is quite unnatural. Now tol = theta.
- Loading branch information
1 parent
a57f636
commit c5cbb93
Showing
138 changed files
with
7,656 additions
and
3,961 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
\documentclass{article} | ||
\usepackage{amsmath,verbatim} | ||
\begin{document} | ||
Suppose we are doing trajectory optimization for the robot with floating base model | ||
\begin{align} | ||
\min_{q,\dot{q},\ddot{q},u,\lambda} \int^T_0 u^TRu\\ | ||
\text{s.t } \begin{bmatrix} H_f\\H_n\end{bmatrix}\ddot{q}+\begin{bmatrix}C_f\\C_n\end{bmatrix}=\begin{bmatrix}0\\I\end{bmatrix}u+\begin{bmatrix}J_f^T\\J_n^T\end{bmatrix}\lambda | ||
\end{align} | ||
where the subscript $f,n$ denote \textsl{floating base} and \textsl{non-floating base} respectively. | ||
|
||
We notice that for the non-floating base part, there is always a feasible control $u$ for any $\ddot{q},\dot{q},q,\lambda$ if we ignore the joint limits. So we can consider to drop that part of the constraint, and only focus on the floating base part. | ||
\begin{align} | ||
\min_{q,\dot{q},\ddot{q},u,\lambda} \int^T_0 u^TRu\\ | ||
\text{s.t } H_f\ddot{q}+C_f=J_f^T\lambda | ||
\end{align} | ||
We notice that $u=H_n\ddot{q}+C_n-J_n^T\lambda$. So the quadratic term in the objective function $u^TRu$ is just a quadratic function of $\ddot{q},\dot{q},q,\lambda$ | ||
\begin{align} | ||
\min_{q,\dot{q},\ddot{q},\lambda} \int^T_0 |H_n\ddot{q}+C_n-J_n^T\lambda|^2_R\\ | ||
\text{s.t } H_f\ddot{q}+C_f=J_f^T\lambda | ||
\end{align} | ||
Still we have $\ddot{q}$ in the decision variable. But we notice that the equality constraint is affine in $\ddot{q}$ and the cost is quadratic in $\ddot{q}$. So the optimal value can be represented as a function of other decision variables $\dot{q},q,\lambda$ only. | ||
\begin{align} | ||
\min_{q,\dot{q},\lambda} \int^T_0 \begin{bmatrix}q\\\dot{q}\\\lambda\end{bmatrix}^TM(q,\dot{q},\lambda)\begin{bmatrix}q\\\dot{q}\\\lambda\end{bmatrix}+N(q,\dot{q},\lambda)^T\begin{bmatrix}q\\\dot{q}\\\lambda\end{bmatrix}\\ | ||
\text{s.t } H_f\ddot{q}+C_f=J_f^T\lambda | ||
\end{align} | ||
Where $M,N$ are matrices depends on $q,\dot{q},\lambda$ | ||
|
||
To transcribe the differential dynamics constraint to algebraic constraint, we consider | ||
\begin{equation} | ||
H_f\ddot{q}=\frac{dH_f\dot{q}}{dt}-\dot{H}_f\dot{q} | ||
\end{equation} | ||
And thus | ||
\begin{equation} | ||
\frac{dH_f\dot{q}}{dt}=J_f^T\lambda-C_f-\dot{H}_f\dot{q} | ||
\end{equation} | ||
We can then assume the term $H_f\dot{q}$ is a cubic Hermite polynomial, and transcribe it to an algebraic constraint that only depends on $q,\dot{q},\lambda$. | ||
|
||
So we end up with an optimization problem with only $q,\dot{q},\lambda$ as decision variables, and 6 constraints only. | ||
\end{document} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.