Skip to content

Commit 99de268

Browse files
author
Amy Blank
committed
added rotation matrix to example 4
1 parent 275baa2 commit 99de268

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

examples/.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Built libbarrett examples
2+
ex01_initialize_wam
3+
ex02_hold_position
4+
ex03_simple_move
5+
ex04_display_basic_info
6+
ex05_systems_intro
7+
ex06_realtime_move
8+
ex07_realtime_data_logging
9+
ex08_teach_and_play
10+
ex09_torque_control
11+
ex10_haptics
12+
ex11_master_master

examples/ex04_display_basic_info.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ int wam_main(int argc, char** argv, ProductManager& pm, systems::Wam<DOF>& wam)
9696
mvprintw(line++,0, " Tool Position (m): ");
9797
mvprintw(line++,0, " Tool Orientation (quat): ");
9898
line++;
99+
mvprintw(line++,0, " ");
100+
mvprintw(line++,0, " Tool Orientation (mat): ");
101+
mvprintw(line++,0, " ");
102+
line++;
99103

100104
if (fts != NULL) {
101105
mvprintw(line++,0, "F/T Sensor");
@@ -137,6 +141,7 @@ int wam_main(int argc, char** argv, ProductManager& pm, systems::Wam<DOF>& wam)
137141
jt_type jt;
138142
cp_type cp;
139143
Eigen::Quaterniond to;
144+
Eigen::Matrix3d R;
140145
math::Matrix<6,DOF> J;
141146

142147
cf_type cf;
@@ -182,6 +187,11 @@ int wam_main(int argc, char** argv, ProductManager& pm, systems::Wam<DOF>& wam)
182187
to = wam.getToolOrientation(); // We work only with unit quaternions. No saturation necessary.
183188
mvprintw(line++,wamX, "%+7.4f %+7.4fi %+7.4fj %+7.4fk", to.w(), to.x(), to.y(), to.z());
184189

190+
R = to.toRotationMatrix(); // convert to a 3x3 rotation matrix
191+
line++;
192+
mvprintw(line++,wamX, "[%+7.4f %+7.4f %+7.4f]", R(0,0), R(0,1), R(0,2));
193+
mvprintw(line++,wamX, "[%+7.4f %+7.4f %+7.4f]", R(1,0), R(1,1), R(1,2));
194+
mvprintw(line++,wamX, "[%+7.4f %+7.4f %+7.4f]", R(2,0), R(2,1), R(2,2));
185195

186196
// FTS
187197
if (fts != NULL) {

0 commit comments

Comments
 (0)