-
Notifications
You must be signed in to change notification settings - Fork 10
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
Added tests for chains #351
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to read the overleaf but I am confused. I propose you
- use L, U, H, T for the link frames, not ABC. Hard enough to read without translating.
- when using a word in the text, always but symbol, and vice versa
- most importantly: I think the parent-child relationship should be consistent, from the trunk (great-grandparent) to hip (grandparent) to upper (parent) to lower (child). So, the wrench unknowns will be F^1_L, F^2_U, F^3_H.
- finally, do the joint numbers agree with A1 URDF? This is maybe the meta-advice: avoid introducing extra translation tables between symbols will make debugging and understanding more clear.
I'll take another look after you make those changes in doc and corresponding symbols in code. Hopefully just global replaces...
adapted overleaf and symbols in code. |
@danbarla can you give me write access on the overleaf? Mostly for commenting but when I see a typo I can immediately fix... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still puzzled, in both overleaf and code, where the wrench from the ground is. Ultimately, we need a force exerted by the ground to keep the robot from falling, right? In the youtube video I did that by creating a "virtual joint" at the contact point and then asserting (via a constraint) that there was no moment exteted by the joint on the child link. I think in that case the child link is the "floor".
overleaf and code updated with the ground constraint. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately I don't have cycles now to do a thorough review. If you think everything is correct, feel free to merge.
@danbarla should we merge this? |
I am actively working on this branch. I will merge it next week. |
…ethods calculate the end effector wrench for a massless leg using chain. Adapted ChainDynamicsGraph class and ChainInitializer.
…ld graph and new graph
Hi @dellaert , |
/** | ||
* @brief Create expression for child wrench adjoint from parent link | ||
*/ | ||
gtsam::Vector6_ childAdjointWrench(gtsam::Vector6_ &wrench_p, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be named childWrenchAdjoint
so it matches the docstring?
InsertTwist(&values, i, t, sampler.sample()); | ||
InsertTwistAccel(&values, i, t, sampler.sample()); | ||
const int i = link->id(); | ||
if (i==0 || i==3 || i==6 || i==9 || i==12) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what's happening here. The link IDs are not guaranteed to be consistent across robots. If these IDs are for the feet, they should be passed in as an argument.
JointVelKey(j, t), JointAccelKey(j, t)}; | ||
for (size_t i = 0; i < keys.size(); i++) | ||
values.insert(keys[i], sampler.sample()[0]); | ||
} | ||
|
||
if (contact_points) { | ||
for (auto&& cp : *contact_points) { | ||
//if (contact_points) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason this is commented out?
const int i = link->id(); | ||
if (i==0 || i==3 || i==6 || i==9 || i==12) | ||
InsertPose(&values, i, t, AddGaussianNoiseToPose(link->bMcom(), sampler)); | ||
//InsertTwist(&values, i, t, sampler.sample()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you've moved these lines outside the if statement, kill these commented out lines?
@@ -303,6 +308,310 @@ TEST(Chain, DynamicalEquality3_H_angles_chain1) { | |||
} | |||
} | |||
|
|||
// Test Chain Constraint Jacobians -AdjointWrenchEquality3 - H_angles - first type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: doxygen comments should be
/// Single line docstring
or
/**
* Multiline docstring
*/
#plt.show() | ||
plt.show() | ||
#plt.rc('pgf', texsystem='pdflatex') | ||
#plt.savefig('/home/dan/Desktop/my_papers/thesis/create_simulation/pyb_sim.pgf') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please kill commented code if you're not using it.
@@ -12,11 +12,12 @@ | |||
|
|||
_ = p.connect(p.GUI) | |||
p.setAdditionalSearchPath(pybullet_data.getDataPath()) # To load plane SDF. | |||
print(pybullet_data.getDataPath()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole file needs some cleaning up IMHO.
|
||
using namespace gtdynamics; | ||
|
||
// Returns a Trajectory object for a single a1 walk cycle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run the formatter on this?
objectives.add(JointObjectives(joint->id(), k).angle(-1.4, prior_model_angles)); | ||
} | ||
|
||
// Add prior on A1 lower joint angles |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please kill commented out code and run the formatter?
${WALK_FORWARD_COMBINED}.run | ||
COMMAND ./${WALK_FORWARD_COMBINED} | ||
DEPENDS ${WALK_FORWARD_COMBINED} | ||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/examples/${PROJECT_NAME}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline please
This PR adds tests to testChain.cpp.
The first test I added compares between classic analysis (wrench constraint for every link) of an A1 leg and kinematic chain analysis. This comes after I had trouble when comparing bigger factor graphs (classic way and chain way) and I had to go simple and follow the math. There is also an overleaf with detailed explanations.
The second test I added sets a basic graph for one leg of the A1 quadruped using DynamicsGraph, and another graph using Chain constraints. the test compares the results and checks them to be identical.
The third test I added compares a Dynamics Graph and a Chain graph for all 4 legs of the A1, for 1 time slice and 4 legs on the ground (robot standing still)