--- /dev/null
+/**
+ * @file battery_test.cc
+ * @date 1 Dec 2010
+ * @author Roland Hieber <rohieb@rohieb.name>
+ *
+ * Application that writes the Roomba's battery status to stdout repeatedly.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include <iostream>
+#include <stdint.h>
+#include <external_interface/pc/pc_os_model.h>
+#include <external_interface/pc/pc_com_uart.h>
+#include <external_interface/pc/pc_timer.h>
+#include <intermediate/robot/roomba/roomba.h>
+#include <intermediate/robot/controlled_motion.h>
+
+using namespace std;
+
+// UART port on which we communicate with the Roomba
+char uart[] = "/dev/ttyUSB0";
+
+typedef wiselib::PCOsModel OsModel;
+typedef wiselib::StandaloneMath Math;
+typedef wiselib::PCComUartModel<OsModel, uart> RoombaUart;
+typedef wiselib::RoombaModel<OsModel, RoombaUart> Roomba;
+typedef wiselib::ControlledMotion<OsModel, Roomba> ControlledMotion;
+
+/**
+ * main function
+ */
+int main(int argc, char ** argv) {
+
+ OsModel::Os os;
+ OsModel::Timer::self_t timer;
+ Roomba roomba;
+ RoombaUart roomba_uart(os);
+ ControlledMotion ctrl_motion;
+
+ // init stuff
+ roomba_uart.set_baudrate(19200);
+ roomba_uart.enable_serial_comm();
+ roomba.init(roomba_uart, timer, Roomba::POSITION
+ | Roomba::BATTERY_AND_TEMPERATURE);
+
+ cout << "Got roomba at " << roomba_uart.address() << endl;
+
+ roomba.reset_distance();
+ roomba.reset_angle();
+ ctrl_motion.init(roomba);
+
+ while(true) {
+ cout << "batt_charge=" << roomba().charge << " batt_capacity="
+ << roomba().capacity << " batt_voltage=" << roomba().voltage
+ << " batt_current=" << roomba().current << endl;
+ sleep(1);
+ }
+}