@@ -61,31 +61,31 @@ int main(int argc, char* argv[])
6161 std::cout << " Arm connected." << std::endl;
6262
6363
64- // ///////////////////////
65- // // MobileIO Setup /////
66- // ///////////////////////
64+ // ////////////////////////
65+ // // MobileIO Setup //////
66+ // ////////////////////////
6767
6868 // Create the MobileIO object
69- std::unique_ptr<util::MobileIO> mobile = util::MobileIO::create (" Arm" , " mobileIO" );
70- if (!mobile )
69+ std::unique_ptr<util::MobileIO> mobile_io = util::MobileIO::create (" Arm" , " mobileIO" );
70+ if (!mobile_io )
7171 {
7272 std::cout << " couldn't find mobile IO device!\n " ;
7373 return 1 ;
7474 }
7575
7676 // Clear any garbage on screen
77- mobile ->resetUI ();
77+ mobile_io ->resetUI ();
7878
7979 // Setup instructions for display
8080 std::string instructions;
8181 instructions = (" B1 - Home Position\n B3 - AR Control Mode\n "
8282 " B6 - Grav Comp Mode\n B8 - Quit\n " );
8383
8484 // Display instructions on screen
85- mobile ->appendText (instructions);
85+ mobile_io ->appendText (instructions);
8686
8787 // Setup state variable for mobile device
88- auto last_mobile_state = mobile ->update ();
88+ auto last_mobile_state = mobile_io ->update ();
8989
9090 // ////////////////////////
9191 // // Main Control Loop ///
@@ -121,61 +121,61 @@ int main(int argc, char* argv[])
121121
122122 if (softstart) {
123123 // End softstart when arm reaches its homePosition
124- if (arm -> atGoal ()){
125- mobile ->appendText (" Softstart Complete!" );
124+ if (arm -> atGoal ()) {
125+ mobile_io ->appendText (" Softstart Complete!" );
126126 softstart = false ;
127127 continue ;
128- }
129- arm -> send ();
128+ }
129+ arm -> send ();
130130
131- // Stay in softstart, don't do any other behavior
132- continue ;
133- }
131+ // Stay in softstart, don't do any other behavior
132+ continue ;
133+ }
134134
135- // Get latest mobile_state
136- auto updated_mobile = mobile ->update (0 );
135+ // Get latest mobile_state
136+ auto updated_mobile_io = mobile_io ->update (0 );
137137
138- if (!updated_mobile )
139- std::cout << " Failed to get feedback from mobile I/O; check connection!\n " ;
140- else
141- {
138+ if (!updated_mobile_io )
139+ std::cout << " Failed to get feedback from mobile I/O; check connection!\n " ;
140+ else
141+ {
142142 // Button B1 - Return to home position
143- if (mobile ->getButtonDiff (1 ) == util::MobileIO::ButtonState::ToOn) {
144- ar_mode = false ;
145- arm -> setGoal (arm::Goal::createFromPosition (4 , home_position));
143+ if (mobile_io ->getButtonDiff (1 ) == util::MobileIO::ButtonState::ToOn) {
144+ ar_mode = false ;
145+ arm -> setGoal (arm::Goal::createFromPosition (4 , home_position));
146146 }
147147
148148 // Button B3 - Start AR Control
149- if (mobile ->getButtonDiff (3 ) == util::MobileIO::ButtonState::ToOn) {
150- xyz_phone_init << mobile -> getLastFeedback ().mobile ().arPosition ().get ().getX (),
151- mobile -> getLastFeedback ().mobile ().arPosition ().get ().getY (),
152- mobile -> getLastFeedback ().mobile ().arPosition ().get ().getZ ();
149+ if (mobile_io ->getButtonDiff (3 ) == util::MobileIO::ButtonState::ToOn) {
150+ xyz_phone_init << mobile_io -> getLastFeedback ().mobile ().arPosition ().get ().getX (),
151+ mobile_io -> getLastFeedback ().mobile ().arPosition ().get ().getY (),
152+ mobile_io -> getLastFeedback ().mobile ().arPosition ().get ().getZ ();
153153 std::cout << xyz_phone_init << std::endl;
154- rot_phone_init = makeRotationMatrix (mobile -> getLastFeedback ().mobile ().arOrientation ().get ());
154+ rot_phone_init = makeRotationMatrix (mobile_io -> getLastFeedback ().mobile ().arOrientation ().get ());
155155 ar_mode = true ;
156156 }
157157
158158 // Button B6 - Grav Comp Mode
159- if (mobile ->getButtonDiff (6 ) == util::MobileIO::ButtonState::ToOn) {
159+ if (mobile_io ->getButtonDiff (6 ) == util::MobileIO::ButtonState::ToOn) {
160160 arm -> cancelGoal ();
161161 ar_mode = false ;
162162 }
163163
164164 // Button B8 - End Demo
165- if (mobile ->getButtonDiff (8 ) == util::MobileIO::ButtonState::ToOn) {
165+ if (mobile_io ->getButtonDiff (8 ) == util::MobileIO::ButtonState::ToOn) {
166166 // Clear MobileIO text
167- mobile ->resetUI ();
167+ mobile_io ->resetUI ();
168168 return 1 ;
169169 }
170170 }
171171
172172 if (ar_mode) {
173173 // Get the latest mobile position and orientation
174174 Eigen::Vector3d xyz_phone;
175- xyz_phone << mobile ->getLastFeedback ().mobile ().arPosition ().get ().getX (),
176- mobile ->getLastFeedback ().mobile ().arPosition ().get ().getY (),
177- mobile ->getLastFeedback ().mobile ().arPosition ().get ().getZ ();
178- auto rot_phone = makeRotationMatrix (mobile ->getLastFeedback ().mobile ().arOrientation ().get ());
175+ xyz_phone << mobile_io ->getLastFeedback ().mobile ().arPosition ().get ().getX (),
176+ mobile_io ->getLastFeedback ().mobile ().arPosition ().get ().getY (),
177+ mobile_io ->getLastFeedback ().mobile ().arPosition ().get ().getZ ();
178+ auto rot_phone = makeRotationMatrix (mobile_io ->getLastFeedback ().mobile ().arOrientation ().get ());
179179
180180 // Calculate new targets
181181 Eigen::Vector3d xyz_scale;
@@ -198,7 +198,7 @@ int main(int argc, char* argv[])
198198 }
199199
200200 // Clear MobileIO text
201- mobile ->resetUI ();
201+ mobile_io ->resetUI ();
202202
203203 return 0 ;
204204}
0 commit comments