Skip to content

Commit 104c869

Browse files
committed
interconnect with rviz
1 parent 1226dfc commit 104c869

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/RotationControl.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ void RotationControl::setValue(const Eigen::Quaterniond &q) {
5050
if (!q.isApprox(_ew->value())) _ew->setValue(q);
5151

5252
updatePose(_q);
53+
_server->setPose(_title, _pose);
54+
_server->applyChanges();
5355

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

125-
_server->insert(imarker);
127+
_server->insert(imarker, boost::bind(&RotationControl::processFeedback, this, _1));
128+
}
129+
130+
void RotationControl::processFeedback(const visualization_msgs::InteractiveMarkerFeedbackConstPtr &feedback)
131+
{
132+
const geometry_msgs::Quaternion &q = feedback->pose.orientation;
133+
setValue(Eigen::Quaterniond(q.w, q.x, q.y, q.z));
126134
}

src/RotationControl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public slots:
3636
void setupUi();
3737
void createInteractiveMarker(const Eigen::Vector3d &position, const QColor &color);
3838
void updatePose(const Eigen::Quaterniond &q);
39+
void processFeedback(const visualization_msgs::InteractiveMarkerFeedbackConstPtr&);
3940

4041
private:
4142
Eigen::Quaterniond _q;

0 commit comments

Comments
 (0)