Closed amcastro-tri closed 7 years ago
methods to query state dependent results
I mentioned this before, but I would really recommend moving these to KinematicsCache
, so that the cache elements inside of it no longer need to be exposed, and so that it can be merged back with KinematicsResults
again.
Thank you for that list @tkoolen!
Regarding your proposal, I was actually thinking more like the KinematicsCache
would be this object the user needs to drag around representing the state of the world but the user actually doesn't really know what it is or how to interact with. The user would rather interact with it performing queries on it through RigidBodyTree
. For instance, something like const Isometry3<T>& RigidBody<T>::get_pose(const KinematicsCache<T>& cache) const
.
In this regard I was thinking to a similar philosophy in System2 where you have the pair System(const)/Context(non-const). In the dynamics world we'd then have the pair RigidBodyTree(const)/KinematicsCache(non-const). Also KinematicsCache
will migrate to a System2 context and cache entries representation.
Another thing I like about this is that both API's for Systme2 and dynamics would have similar semantics, homogenizing API's across our code base. What do you think?
And I would like us to get to the point soon where we are literally using the System 2 Context in the RBTree API (in place of KinematicsCache), so that we don't have two separate caching schemes and a bunch of unnecessary pack/unpack/copy operations.
the KinematicsCache would be this object the user needs to drag around representing the state of the world but the user actually doesn't really know what it is or how to interact with
That's the current status quo, and the bad thing about it is that the internals of the cache need to be exposed in this case (this being the main reason for the creation of KinematicsResults
).
@sherm1 I'm a bit wary of this. We'd talked about the need to be able to run RBT independent of the system 2 architecture. Would passing a System 2 Context instance be consistent with that?
I haven't thought deeply about this, but I have the same knee-jerk reaction as @SeanCurtis-TRI. Surely RBTree can just consume some (set of) mutable pointer(s) to AwesomeFutureKinematicsData
, which may or may not point into a System2 cache entry?
Most of the real value of the Context's caching utility won't be apparent until we are using it in RBTree, where really expensive things get calculated and reused frequently. Also, when an RBTree is used as a component in a System, most of the state variables and computational cost will come from the RBTree. I think it will prove much easier to do this directly in the RBTree API than to implement and maintain an interface layer to keep RBTree Context-free (to coin a phrase :). RBTree already has a similar dependency on KinematicsCache; we should just replace that with Context which is a more general version.
A checklist to keep track of the planned work on RBT this quarter. I'll keep updating as I move along.
RBT
on<T>
. PR first a templatization on a dummy scalar type<T>
and replace occurrences ofRBT
withRBT<T>
. Functionality is left intact. Methods are still templated on<Scalar>
. Parameters are stilldouble
. See #3987 for details.KinematicsCache
to break dependency onRigidBody
. PR #4378 merged.drake/multibody
files to follow style guide (CamelCase vs snake_case, cpp vs cc). See #4082. #4098 merged.ConstraintWrappers.h
onRigidBodyTree.h
. Or ratherdrakeIK
are in the same directory asRigidBodyTree
. Where should they be moved and how (if) would they need to be restructured?RigidBody::get_pose()
), 4) global methods such as inverse/forward dynamics.Context
instead ofKinematicsCache
inRBT
methods. A first cut would place the entireKinematicsCache
in a single cache entry.RBT::addFrame(shared_ptr<RigidBodyFrame> frame)
and the concept ofRigidBodyFrame
for RBT.RBT::add_model_instance()
. The only thing it does is to increment a counter. It doesnt seem to "add a model".getRandomConfiguration
should return aVectorX<T>
instead ofVectorXd
. Set derivatives to zero.RigidBodyTreeContact.cpp
and its dependencies.RBT
template methods onScalar
with methods templated on the class' parameter<T>
RigidBodyTree.cpp
onparser_common.cc
. RigidBodyTree should not depend on parsers and neigher drakeRBM. Evaluate if this file should be removed and where the methodAddFloatingJoint
should go or even exist.drakeRBM
on any of theparser_*
files.drakeRBM
ondrakeRigidBodyConstraint
.drakeRBM
ondrakeOptimization
.