From 3d9a5e6ff6d98f9dc09b123918755f0f7711a6c7 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Fri, 5 Apr 2013 23:43:18 +0200 Subject: digital/io-hub/src/apbirthday: use transient command for beacon Also reorder beacon function calls in main loop. --- digital/io-hub/src/apbirthday/robot.cc | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'digital/io-hub/src/apbirthday') diff --git a/digital/io-hub/src/apbirthday/robot.cc b/digital/io-hub/src/apbirthday/robot.cc index 4b822f1a..ca9d6a64 100644 --- a/digital/io-hub/src/apbirthday/robot.cc +++ b/digital/io-hub/src/apbirthday/robot.cc @@ -112,24 +112,21 @@ Robot::main_loop () // Wait until next cycle. hardware.wait (); // Update IO modules. - if (zb_i2c_queue_.sync ()) - { - Position robot_pos; - asserv.get_position (robot_pos); - beacon.send_position (robot_pos.v); - } - if (usdist_control_.update ()) - { - Position robot_pos; - asserv.get_position (robot_pos); - radar_.update (robot_pos, obstacles); - } obstacles.update (); pressure.update (); jack.update (); outputs_set_.update (); // Handle communications. bool sync = main_i2c_queue_.sync (); + zb_i2c_queue_.sync (); + Position robot_pos; + asserv.get_position (robot_pos); + beacon.send_position (robot_pos.v); + // Look for obstacles. + if (usdist_control_.update ()) + { + radar_.update (robot_pos, obstacles); + } // Handle events if synchronised. if (sync && fsm_debug_state_ != FSM_DEBUG_STOP) { -- cgit v1.2.3