From f6be7e61cd8ee3cfadf1d83c48a1b5b8d1628c0d Mon Sep 17 00:00:00 2001 From: svnhieber Date: Thu, 2 Dec 2010 17:21:31 +0000 Subject: [PATCH] print SVN revision in log output git-svn-id: https://svn.itm.uni-luebeck.de/wisebed/wiselib/trunk/pc_apps/roomba_tests@3674 f8795833-4959-0410-8ae9-8bcb0cfab428 --- Makefile | 28 +++++++++++++++++++--------- main.cc | 22 ++++++++++------------ svnrevision.sh | 13 +++++++++++++ 3 files changed, 42 insertions(+), 21 deletions(-) create mode 100755 svnrevision.sh diff --git a/Makefile b/Makefile index 463fe55..63e8b19 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,26 @@ -export TARGET=roomba_test -export SOURCES=main.cc -export CXXFLAGS=-I/usr/include/qt4 -I/usr/include/qt4/QtCore \ - -I/usr/include/qt4/QtGui -lQtGui \ - -I/usr/include/ -I/usr/include/QtCore \ - -I/usr/include/QtGui -lQtGui +WISELIB_PATH=../.. +WISELIB_STABLE=$(WISELIB_PATH)/wiselib.stable +WISELIB_TESTING=$(WISELIB_PATH)/wiselib.testing +QTCXXFLAGS=-I/usr/include/qt4 -I/usr/include/qt4/QtCore \ + -I/usr/include/qt4/QtGui -I/usr/include/QtCore -I/usr/include/QtGui \ + -lQtGui + +CXX=g++ +LD=ld +CXXFLAGS=-I$(WISELIB_STABLE) -I$(WISELIB_TESTING) -lpthread +LDFLAGS= all: roomba_test battery_test clean: - rm -f battery_test $(TARGET) + rm -f roomba_test battery_test svnrevision.h + +svnrevision.h: + ./svnrevision.sh -include ../Makefile.base +roomba_test: main.cc svnrevision.h + $(CXX) $(CXXFLAGS) $< -o $@ $(QTCXXFLAGS) battery_test: battery_test.cc - $(CXX) -I$(WISELIB_STABLE) -I$(WISELIB_TESTING) -lpthread -o battery_test battery_test.cc + $(CXX) $(CXXFLAGS) $< -o $@ +# vim: noexpandtab : diff --git a/main.cc b/main.cc index ffe54bb..2363146 100644 --- a/main.cc +++ b/main.cc @@ -22,12 +22,9 @@ * THE SOFTWARE. */ -//#include "main.h" +#include "svnrevision.h" #include #include -//#include -//#include "util/standalone_math.h" -//#include "util/delegates/delegate.hpp" #include #include #include @@ -136,14 +133,15 @@ void drive(Roomba& roomba, ControlledMotion& ctrl_motion) { + "Input travelled distance on y axis in mm:", deviation_y, numeric_limits::min(), numeric_limits::max(), 1, &ok); if(ok) { - cout << "input_distance=" << input_distance << " velocity=" << velocity - << " internal_distance=" << roomba.distance() << " deviation_x=" - << deviation_x << " deviation_y=" << deviation_y - << " encoder_ticks_left=" << sensor_data.left_encoder_counts - << " encoder_ticks_right=" << sensor_data.right_encoder_counts - << " batt_charge=" << sensor_data.charge << " batt_capacity=" - << sensor_data.capacity << " batt_voltage=" << sensor_data.voltage - << " batt_current=" << sensor_data.current << endl; + cout << "svn=" << SVNREVISION << " input_distance=" << input_distance + << " velocity=" << velocity << " internal_distance=" + << roomba.distance() << " deviation_x=" << deviation_x + << " deviation_y=" << deviation_y << " encoder_ticks_left=" + << sensor_data.left_encoder_counts << " encoder_ticks_right=" + << sensor_data.right_encoder_counts << " batt_charge=" + << sensor_data.charge << " batt_capacity=" << sensor_data.capacity + << " batt_voltage=" << sensor_data.voltage << " batt_current=" + << sensor_data.current << endl; } else { break; } diff --git a/svnrevision.sh b/svnrevision.sh new file mode 100755 index 0000000..67b03a2 --- /dev/null +++ b/svnrevision.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +revision=$(svn info|grep Revision|sed 's/Revision: //') + +if [ -n "$(svn status|grep '^M')" ]; then + status=" with local changes" +else + status="" +fi; + +echo '// This file is created automatically, your changes will be lost.' > svnrevision.h +echo '#define SVNREVISION "r'$revision$status'"' >> svnrevision.h + -- 2.20.1