-
Notifications
You must be signed in to change notification settings - Fork 9
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
Implement add and removal for links and joints #93
Implement add and removal for links and joints #93
Conversation
@swhart115 since there was some overlap between our pull requests I went and merged yours with mine. I had to change things a bit to work with the changes I made so would you mind testing it out and make sure the functionality you were wanting is still there? |
@Levi-Armstrong: could you detail a bit where you made use of functionality added by @swhart115? |
This works quite well. I'm not sure always removing a joint when removing the |
I'm not sure this is a result of the changes by @Levi-Armstrong or if it was already present in #87, but dragging-and-dropping randomly made some of the links in my Fetch model disappear / attach to a random other link. Perhaps something is not entirely correct in the mappings between TreeItems and links? Or the updates to those structures? |
void addToTreeWidget(urdf::LinkSharedPtr link, QTreeWidgetItem* parent); | ||
void addToTreeWidget(urdf::JointSharedPtr joint, QTreeWidgetItem* parent); | ||
|
||
void addModelLink(QTreeWidgetItem* parent); | ||
urdf::LinkSharedPtr addModelLink(QTreeWidgetItem* parent); |
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.
All these addX
and removeX
are probably candidates for a round of refactoring. That's essentially what you already suggested @Levi-Armstrong, some time ago (ie: create a bunch of helpers to add/remove links/joints to a urdf
data structure). Not sure how much priority we want to give that, but it would remove model-manipulation from the URDFProperty
, which I think it is a good thing.
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.
Are we still planning at some point to move to our own internal data structure? If so this would be a good place to for all of the these methods.
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.
Yes, we'll have to move away from urdf eventually. For now a simple refactor to get these methods out of this class would be good enough.
} | ||
|
||
// during the removal process the urdf is broken then fixed, so an update is required. | ||
on_propertyWidget_valueChanged(); |
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 emit
ted? Not sure if you intentionally wanted to keep this local to this class.
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.
Does emit work on SLOT's; I assumed it was only for SIGNALS?
I've reviewed 4745792 and added comments through this PR, but overall this looks nice. Do you think refactoring some of the |
@Levi-Armstrong I am testing the drag-and-drop functionality under this PR #93 . There seems to be one capability not carried over, and that's the ability to drag a link/subtree out of the chain (the two-roots case). There has been a lot of discussion on this given that it results in an invalid URDF, but also doesn't let the user change the root link after its created, as a result. @gavanderhoorn what is the call on this? Do we want to allow invalid, multi-root Link structures, or do we want to prevent this from happening? |
Also, dragging and dropping of joints seems to be allowed, but my original PR prevented this from happening. Due to @Levi-Armstrong 's changes, it reorganizes the link tree accordingly. So i'm fine allowing this, if @gavanderhoorn is cool with it. |
@swhart115 wrote:
I'm not sure how intuitive drag-and-drop for joints is: it's certainly something that is possible, but does it add anything? Links being a tree structure -- and then re-ordering the branches -- makes sense to me, but for joints I'm not sure. Can we come up with a use-case where re-ordering joints (in a tree!) makes sense / is easier than doing it with the links? |
@swhart115 wrote:
I don't really have a preference for how, as long as we have a simple/intuitive way to rearrange a link tree such that we can change the root link. |
@gavanderhoorn I've been advocating the removal of the tree structure for the joints for awhile, instead just providing them in a list under That being said, it would be nice to have an easier way to see what joints are associated with a link other then manually clicking through each joint and reading what the parent and child is. I'd advocate adding new properties to the links that show the parent and (possibly multiple) children joints. |
This is not the case right now. You are stuck with the initial root link. I will add the functionality back in as it was before the merge with #93 |
If the joints are shown in a flat list, what about:
or a similar approach? Adding properties is possible, but a) implies they can be changed from there as well (I would not be in favour of that) and b) properties are invisible until a user clicks on the link. |
@swhart115 wrote:
Could you do that in a separate branch? So we can compare the two alternatives? |
@gavanderhoorn wrote:
a) What if they are just uneditable properties? b) this is still better then having to go through and click on each joint to see if it has a particular link as its parent. |
@swhart115 wrote:
a) that would be ok, but all other properties are editable, so that could be counter-intuitive, b) I agree, hence my suggestion to show this in the tree itself. |
|
@gavanderhoorn I have started to refactor the mapping. Is the implementation for the mapping get methods what you looking for? |
@gavanderhoorn: I do see a case where the user entered the wrong information for a joint and they need to reassign it to another link. In this case I could set it up so when the child link of the joint is changed it performs a swap between the this joint and the joint that is currently assigned to the selected child link. Would this be desirable behavior; I am just trying to prevent from breaking the urdf if possible? The other option would be to provide copy past functionality.
|
@Levi-Armstrong wrote:
hm. Not sure what the best approach here is. Swapping could lead to unintuitive situations (if the joint is swapped with something that is 'far away' in the model, parts of the geometry will suddenly be somewhere completely different from where they are 'now'). Let's leave the behaviour as it is right now. If not being able to delete a link without the joint is really a problem, we should ticket it and deal with it then. |
@Levi-Armstrong: now that you have opened #97, should this PR be closed? |
Yes, I did not want to close it until you had a chance to review the other pull request. |
This implements the right click option for adding and removing links. When links are added an removed joints are automatically added and removed to prevent have a malformed urdf. Also the rearranging of joints is controlled by the on_propertyWidget_jointParentLinkChanged SLOT.