Skip to content

Commit

Permalink
interconnect with rviz
Browse files Browse the repository at this point in the history
  • Loading branch information
rhaschke committed Oct 25, 2015
1 parent 1226dfc commit 104c869
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/RotationControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ void RotationControl::setValue(const Eigen::Quaterniond &q) {
if (!q.isApprox(_ew->value())) _ew->setValue(q);

updatePose(_q);
_server->setPose(_title, _pose);
_server->applyChanges();

emit valueChanged(q);
}
Expand Down Expand Up @@ -122,5 +124,11 @@ void RotationControl::createInteractiveMarker(const Eigen::Vector3d &pos,
ctrl.markers.push_back(createBoxMarker(3*s, 2*s, 1*s, color));
imarker.controls.push_back(ctrl);

_server->insert(imarker);
_server->insert(imarker, boost::bind(&RotationControl::processFeedback, this, _1));
}

void RotationControl::processFeedback(const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback)
{
const geometry_msgs::Quaternion &q = feedback->pose.orientation;
setValue(Eigen::Quaterniond(q.w, q.x, q.y, q.z));
}
1 change: 1 addition & 0 deletions src/RotationControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public slots:
void setupUi();
void createInteractiveMarker(const Eigen::Vector3d &position, const QColor &color);
void updatePose(const Eigen::Quaterniond &q);
void processFeedback(const visualization_msgs::InteractiveMarkerFeedbackConstPtr&);

private:
Eigen::Quaterniond _q;
Expand Down

0 comments on commit 104c869

Please # to comment.