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

Remove / Re-Name std::shared_ptr<RigidBodyFrame> "weld_to_frame" #3093

Closed
liangfok opened this issue Aug 9, 2016 · 16 comments
Closed

Remove / Re-Name std::shared_ptr<RigidBodyFrame> "weld_to_frame" #3093

liangfok opened this issue Aug 9, 2016 · 16 comments
Assignees
Labels
good first issue Thinking of contributing? These issues might be a good place to start. priority: low type: cleanup unused team: dynamics

Comments

@liangfok
Copy link
Contributor

liangfok commented Aug 9, 2016

It should ideally be a const reference or unique_ptr. This entails modifying the APIs of RigidBodyTree and RigidBodySystem.

In addition, per discussion in #4107, consider renaming it so it does not sound like a function. Consider frame or weld_frame.

@scpeters
Copy link
Contributor

Do you have any policies about changing API/ABI? I'll go look in the docs...

@scpeters
Copy link
Contributor

I didn't see any mention of changing API/ABI in the docs. If drake CI is clean, is that all you're concerned with? There aren't any downstream packages that use drake that we need to worry about changing API/ABI?

@jwnimmer-tri
Copy link
Collaborator

ABI is not a concern (downstream always build from source, at the moment).

We have Russ's blessing to change APIs (with a CHANGELOG.md entry), presuming we have a good reason. (For example, randomly renaming things isn't super helpful, but hiding implementation details would be, or broadening the method to support more use cases, etc.) In short, there are some downstream users, but they try to track our changes, and will be happier if the API breaks are for the greater good.

I haven't thought about whether this particular change is of merit in that context (or even worth pursuing in the near term).

@jwnimmer-tri
Copy link
Collaborator

Also, plans to edit the RidigBodyTree should be circulated to the Dynamics team for input, so /CC @sherm1 and @amcastro-tri who can rope anyone else in.

@scpeters
Copy link
Contributor

Ok, it's marked as high priority, but I'll wait to see what is the consensus.

@jwnimmer-tri
Copy link
Collaborator

Heh, I didn't see that. I think @liangfok was perhaps a bit generous with that label. Let's have @sherm1 and @amcastro-tri definitely weigh in on what to do here.

@liangfok
Copy link
Contributor Author

Ha! Yeah, I don't know what I was thinking when I set the priority. Since it's not blocking anyone at the moment, I'll downgrade the priority.

@sherm1
Copy link
Member

sherm1 commented Sep 23, 2016

I believe this change (or at least some change to weld_to_frame) was suggested by @amcastro-tri so I will leave it to him to comment.

@amcastro-tri
Copy link
Contributor

Getting rid of share_ptr's is a good improvement I think. This is something I started in my first huge PR #2207 when I started at TRI and I would be thrilled if @scpeters wants now to clean the RigidBodyFrame shared_ptr's.

It will also be a big PR because, as you will see when you start doing it, the shared_ptr's very easily propagate and contaminate entire code, hiding ownership and creating many times difficult to understand cross references. This change will touch many files: RigidBodySystem, RigidBodyTree, RigidBody, parsers, tests, etc. However it can only be done in one single pass.

RigidBodySystem now contains a std::vector of shared pointers to RigidBodySensor's. I would start by making those unique_ptr's (the system owns them, or should). Then replace every other shared_ptr<RigidBodyFrame> in the code base with either a reference (const where appropriate) or a raw pointer, depending on whether null semantics is needed or not.

@sherm1
Copy link
Member

sherm1 commented Sep 23, 2016

Is RigidBodyPlant also contaminated with shared_ptr leakage?

@liangfok
Copy link
Contributor Author

liangfok commented Sep 23, 2016

Luckily, @amcastro-tri did an excellent job preventing contamination of RigidBodyPlant. It simply maintains a unique_ptr to a RigidBodyTree.

@amcastro-tri
Copy link
Contributor

yes! I hate shared_ptr's!
BTW, thank you for the nice comment @liangfok!

@liangfok liangfok changed the title Remove std::shared_ptr<RigidBodyFrame> "weld_to_frame" Remove / Re-Name std::shared_ptr<RigidBodyFrame> "weld_to_frame" Nov 21, 2016
@jwnimmer-tri
Copy link
Collaborator

I'm not sure this is relevant anymore, given the planned deprecation of RBT?

@liangfok
Copy link
Contributor Author

@amcastro-tri, what do you think? Should this be merged into #5013?

@liangfok liangfok assigned amcastro-tri and unassigned liangfok Mar 20, 2017
@amcastro-tri
Copy link
Contributor

We know we should not be using shared pointers in the way they are being used for RigidBodyFrame objects. This was already taken into account in the design of MultibodyTree's API.
MultibodyTree also will introduce (as early as this week) the concept of frames with a slight difference in semantics and API to allow the modeling of soft bodies.
Therefore I think this is not relevant anymore unless it is blocking somebody's work? @liangfok, thank you for bringing it up to my attention, should I worry about closing this? do you know of someone who needs this to be resolved?

@liangfok
Copy link
Contributor Author

Thanks @amcastro-tri. I'll go ahead and close this issue since I don't think it's blocking anyone and MBT will have a totally different API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Thinking of contributing? These issues might be a good place to start. priority: low type: cleanup unused team: dynamics
Projects
None yet
Development

No branches or pull requests

5 participants