Skip to content

Commit

Permalink
Fix to show TF on load
Browse files Browse the repository at this point in the history
  • Loading branch information
Levi Armstrong committed May 16, 2016
1 parent ee4f583 commit 70b2b44
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
2 changes: 2 additions & 0 deletions urdf_editor/include/urdf_editor/urdf_property.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ namespace urdf_editor
void on_propertyWidget_linkValueChanged(LinkProperty *property);

void on_unsavedChanges();
void on_unsavedChanges(JointProperty *property);

private:
bool redrawRobotModel();
Expand All @@ -54,6 +55,7 @@ namespace urdf_editor
QWidget *browser_parent_;
urdf_editor::MyRviz *rviz_widget_;
boost::shared_ptr<URDFTransformer> tf_transformer_;
bool loading_;
};
}

Expand Down
4 changes: 2 additions & 2 deletions urdf_editor/include/urdf_editor/urdf_property_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ namespace urdf_editor
void valueChanged();

// Link SIGNALS
void linkAddition();
void linkAddition(LinkProperty *property);
void linkDeletion();
void linkValueChanged(LinkProperty *property);

// Joint SIGNALS
void jointAddition();
void jointAddition(JointProperty *property);
void jointDeletion();
void jointNameChanged(JointProperty *property, QString current_name, QString new_name);
void jointParentLinkChanged(JointProperty *property, QString current_name, QString new_name);
Expand Down
18 changes: 15 additions & 3 deletions urdf_editor/src/urdf_property.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ namespace urdf_editor
connect(property_editor_.get(), SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(on_propertyWidget_customContextMenuRequested(QPoint)));

connect(tree_widget_, SIGNAL(jointAddition()), SLOT(on_unsavedChanges()));
connect(tree_widget_, SIGNAL(jointAddition(JointProperty*)), SLOT(on_unsavedChanges(JointProperty*)));

connect(tree_widget_, SIGNAL(jointDeletion()), SLOT(on_unsavedChanges()));

connect(tree_widget_, SIGNAL(linkAddition()), SLOT(on_unsavedChanges()));
connect(tree_widget_, SIGNAL(linkAddition(LinkProperty*)), SLOT(on_unsavedChanges()));

connect(tree_widget_, SIGNAL(linkDeletion()), SLOT(on_unsavedChanges()));

Expand All @@ -93,6 +93,7 @@ namespace urdf_editor

bool URDFProperty::loadURDF(QString file_path)
{
loading_ = true;
urdf::ModelInterfaceSharedPtr model = urdf::parseURDFFile(file_path.toStdString());

if (!tree_widget_->loadRobotModel(model))
Expand All @@ -103,6 +104,8 @@ namespace urdf_editor

rviz_widget_->updateBaseLink(model->getRoot()->name);

loading_ = false;

return true;
}

Expand Down Expand Up @@ -477,9 +480,18 @@ namespace urdf_editor
}


void URDFProperty::on_unsavedChanges(JointProperty *property)
{
if (!loading_)
unsavedChanges = true;

tf_transformer_->updateLink(property);
}

void URDFProperty::on_unsavedChanges()
{
unsavedChanges = true;
if (!loading_)
unsavedChanges = true;
}

void URDFProperty::on_propertyWidget_jointParentLinkChanged(JointProperty *property, QString current_name, QString new_name)
Expand Down
9 changes: 6 additions & 3 deletions urdf_editor/src/urdf_property_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ namespace urdf_editor
link_names_.append(item->getName());

parent->addChild(item);

emit linkAddition(item->getProperty().get());

return item;
}

Expand Down Expand Up @@ -347,6 +350,9 @@ namespace urdf_editor
joint_names_.append(item->getName());

parent->addChild(item);

emit jointAddition(item->getProperty().get());

return item;
}

Expand Down Expand Up @@ -418,7 +424,6 @@ namespace urdf_editor
QTreeWidgetItem *sel = getSelectedItem();
URDFPropertyTreeLinkItem *new_link = addLinkTreeItem(sel, addModelLink());
sel->setExpanded(true);
emit linkAddition();

if (link_names_.count() > 2 && !isLinkRoot(sel->parent()))
{
Expand All @@ -429,15 +434,13 @@ namespace urdf_editor
URDFPropertyTreeJointItem *new_joint = addJointTreeItem(parent, joint);
parent->setExpanded(true);
new_link->assignJoint(new_joint);
emit jointAddition();
}
else if (link_names_.count() == 2 || isLinkRoot(sel->parent()))
{
urdf::JointSharedPtr joint = addModelJoint(new_link->getName());
URDFPropertyTreeJointItem *new_joint = addJointTreeItem(joint_root_, joint);
joint_root_->setExpanded(true);
new_link->assignJoint(new_joint);
emit jointAddition();
}
}

Expand Down

0 comments on commit 70b2b44

Please sign in to comment.