summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author <philippe colliot>2014-08-11 16:42:54 +0200
committer <philippe colliot>2014-08-11 16:42:54 +0200
commit4b52051da0ccee823dbc8aeac47c437e76b3553d (patch)
treed05f53efbfc07858e5090541e9603aeab29cff09
parent331d42785ed0a71e30bf2452312b4693d2e1c277 (diff)
downloadnavigation-alpha_with_basic_hmi.tar.gz
improve fsa warning, script move to python3alpha_with_basic_hmi
-rw-r--r--src/fuel-stop-advisor/ctripcomputer.cpp2
-rw-r--r--src/fuel-stop-advisor/fuel-stop-advisor.cpp12
-rw-r--r--src/fuel-stop-advisor/fuel-stop-advisor.xml14
-rw-r--r--src/hmi/qml/NavigationBrowseMap.qml37
-rw-r--r--src/hmi/qml/NavigationCalculatedRoute.qml6
-rw-r--r--src/hmi/qml/TripComputer.qml5
-rwxr-xr-x[-rw-r--r--]test/script/README23
-rwxr-xr-x[-rw-r--r--]test/script/configTests.py2
-rwxr-xr-x[-rw-r--r--]test/script/simulation-dashboard.py42
9 files changed, 90 insertions, 53 deletions
diff --git a/src/fuel-stop-advisor/ctripcomputer.cpp b/src/fuel-stop-advisor/ctripcomputer.cpp
index 735b864..01db594 100644
--- a/src/fuel-stop-advisor/ctripcomputer.cpp
+++ b/src/fuel-stop-advisor/ctripcomputer.cpp
@@ -32,7 +32,7 @@
CTripComputer::CTripComputer()
{
- m_version.date = "1-12-2013";
+ m_version.date = "11-08-2014";
m_version.major = 1;
m_version.minor = 0;
m_version.micro = 0;
diff --git a/src/fuel-stop-advisor/fuel-stop-advisor.cpp b/src/fuel-stop-advisor/fuel-stop-advisor.cpp
index 5f56373..9bfac95 100644
--- a/src/fuel-stop-advisor/fuel-stop-advisor.cpp
+++ b/src/fuel-stop-advisor/fuel-stop-advisor.cpp
@@ -180,6 +180,7 @@ class FuelStopAdvisor
// init fsa settings
advisorMode=false;
distanceThreshold=0;
+ destinationCantBeReached=false;
routeHandle=0;
initFlag=true;
}
@@ -421,8 +422,13 @@ class FuelStopAdvisor
printf("Advisor %f vs %d\n",remaining, distanceThreshold);
if (remaining < distanceThreshold) {
printf("Warning %f < %d\n",remaining, distanceThreshold);
- FuelStopAdvisorWarning();
+ destinationCantBeReached = true;
}
+ else
+ {
+ destinationCantBeReached = false;
+ }
+ FuelStopAdvisorWarning(destinationCantBeReached);
TripDataUpdated(0); //arg is for future use
}
}
@@ -437,10 +443,11 @@ class FuelStopAdvisor
}
void
- GetFuelAdvisorSettings(bool& advisorMode, uint8_t& distanceThreshold)
+ GetFuelAdvisorSettings(bool& advisorMode, uint8_t& distanceThreshold, bool& destinationCantBeReached)
{
advisorMode=this->advisorMode;
distanceThreshold=this->distanceThreshold;
+ destinationCantBeReached=this->destinationCantBeReached;
}
void SetRouteHandle(const uint32_t& routeHandle)
@@ -471,6 +478,7 @@ class FuelStopAdvisor
CTripComputer *mp_tripComputer;
bool advisorMode;
uint8_t distanceThreshold;
+ bool destinationCantBeReached;
uint32_t routeHandle;
bool initFlag;
double lastTime;
diff --git a/src/fuel-stop-advisor/fuel-stop-advisor.xml b/src/fuel-stop-advisor/fuel-stop-advisor.xml
index f6cb6fe..a7cf2ef 100644
--- a/src/fuel-stop-advisor/fuel-stop-advisor.xml
+++ b/src/fuel-stop-advisor/fuel-stop-advisor.xml
@@ -5,7 +5,7 @@
<node name="/org/genivi/demonstrator" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="introspect.xsd">
<interface name="org.genivi.demonstrator.FuelStopAdvisor">
- <version>beta (26-06-2014)</version>
+ <version>1.0.0 (11-08-2014)</version>
<doc>
<line>FuelStopAdvisor = This interface offers functionalities to access the fuel stop advisor features</line>
<line>This interface is defined for the FSA demonstrator and not included into the GENIVI compliance</line>
@@ -163,6 +163,11 @@
<line>distanceThreshold= value of type 'y' that expresses the distance threshold in METRIC->kilometers or in NON_METRIC->miles</line>
</doc>
</arg>
+ <arg name="destinationCantBeReached" type="b" direction="out">
+ <doc>
+ <line>destinationCantBeReached = TRUE means that there's a risk of not reaching the destination </line>
+ </doc>
+ </arg>
</method>
<method name="SetRouteHandle">
@@ -189,8 +194,13 @@
<signal name="FuelStopAdvisorWarning">
<doc>
- <line>FuelStopAdvisorWarning = This signal is emitted to notify a client application that there's a risk of not reaching the destination</line>
+ <line>FuelStopAdvisorWarning = This signal is emitted to notify a client application whether there's a risk of not reaching the destination</line>
</doc>
+ <arg name="destinationCantBeReached" type="b">
+ <doc>
+ <line>destinationCantBeReached = TRUE means that there's a risk of not reaching the destination </line>
+ </doc>
+ </arg>
</signal>
</interface>
diff --git a/src/hmi/qml/NavigationBrowseMap.qml b/src/hmi/qml/NavigationBrowseMap.qml
index 738a740..ac97994 100644
--- a/src/hmi/qml/NavigationBrowseMap.qml
+++ b/src/hmi/qml/NavigationBrowseMap.qml
@@ -121,7 +121,23 @@ HMIMenu {
function fuelStopAdvisorWarning(args)
{
- fuel.text="F";
+ if (args[0] == 'bool')
+ {
+ if (args[1] == 1)
+ {
+ fuel.text="F";
+ }
+ else
+ {
+ fuel.text=" ";
+ }
+ }
+ else
+ {
+ console.log("Unexpected result from fuelStopAdvisorWarning:");
+ Genivi.dump("",args);
+ }
+
}
function connectSignals()
@@ -142,14 +158,6 @@ HMIMenu {
mapmatchedpositionPositionUpdateSignal.destroy();
mapmatchedpositionAddressUpdateSignal.destroy();
fuelStopAdvisorSignal.destroy();
- Genivi.fuel_stop_advisor_message(dbusIf,"SetFuelAdvisorSettings",["boolean",0,"uint8",0]);
- if (Genivi.g_routing_handle) {
- Genivi.fuel_stop_advisor_message(dbusIf,"ReleaseRouteHandle",Genivi.g_routing_handle);
- }
- else
- {
- Genivi.fuel_stop_advisor_message(dbusIf,"ReleaseRouteHandle",0);
- }
}
function showSurfaces()
@@ -329,6 +337,8 @@ HMIMenu {
}
if (res[1] == Genivi.NAVIGATIONCORE_INACTIVE) {
stop.disabled=true;
+ //Guidance inactive, so inform the trip computer
+ Genivi.fuel_stop_advisor_message(dbusIf,"SetFuelAdvisorSettings",["boolean",0,"uint8",0]);
guidance="No guidance";
maneuver="No maneuver";
maneuver_distance="";
@@ -337,6 +347,8 @@ HMIMenu {
return;
} else {
stop.disabled=false;
+ //Guidance active, so inform the trip computer (refresh)
+ Genivi.fuel_stop_advisor_message(dbusIf,"SetFuelAdvisorSettings",["boolean",1,"uint8",50]);
}
var res=Genivi.guidance_message_get(dbusIf,"GetManeuversList",["uint16",1,"uint32",0]);
@@ -667,12 +679,5 @@ HMIMenu {
showZoom();
updateAddress();
updateDayNight();
- if (Genivi.g_routing_handle) {
- Genivi.fuel_stop_advisor_message(dbusIf,"SetRouteHandle",Genivi.g_routing_handle);
- Genivi.fuel_stop_advisor_message(dbusIf,"SetFuelAdvisorSettings",["boolean",1,"uint8",50]);
- } else {
- Genivi.fuel_stop_advisor_message(dbusIf,"ReleaseRouteHandle",0);
- Genivi.fuel_stop_advisor_message(dbusIf,"SetFuelAdvisorSettings",["boolean",0,"uint8",0]);
- }
}
}
diff --git a/src/hmi/qml/NavigationCalculatedRoute.qml b/src/hmi/qml/NavigationCalculatedRoute.qml
index 1063422..1b608c4 100644
--- a/src/hmi/qml/NavigationCalculatedRoute.qml
+++ b/src/hmi/qml/NavigationCalculatedRoute.qml
@@ -54,6 +54,8 @@ HMIMenu {
//Genivi.dump("",args);
menu.text=Genivi.gettext("CalculatedRouteFailed");
+ // Tell the FSA that there's no route available
+ Genivi.fuel_stop_advisor_message(dbusIf,"ReleaseRouteHandle",Genivi.g_routing_handle);
}
function routeCalculationProgressUpdate(args)
@@ -71,7 +73,7 @@ HMIMenu {
} else {
guidance_start.disabled=false;
guidance_stop.disabled=true;
- }
+ }
}
function routeCalculationSuccessful(args)
@@ -116,6 +118,8 @@ HMIMenu {
console.log("Unexpected result from GetRouteOverview:\n");
Genivi.dump("",res);
}
+ // Give the route handle to the FSA
+ Genivi.fuel_stop_advisor_message(dbusIf,"SetRouteHandle",Genivi.g_routing_handle);
updateStartStop();
}
diff --git a/src/hmi/qml/TripComputer.qml b/src/hmi/qml/TripComputer.qml
index 9bd88d7..a812245 100644
--- a/src/hmi/qml/TripComputer.qml
+++ b/src/hmi/qml/TripComputer.qml
@@ -195,11 +195,6 @@ HMIMenu {
}
}
} else {
- if (Genivi.g_routing_handle) {
- Genivi.fuel_stop_advisor_message(dbusIf,"SetRouteHandle",Genivi.g_routing_handle);
- } else {
- Genivi.fuel_stop_advisor_message(dbusIf,"ReleaseRouteHandle",Genivi.g_routing_handle);
- }
res=Genivi.fuel_stop_advisor_message(dbusIf,"GetInstantData",[]);
for (var i = 0 ; i < res[1].length ; i+=4) {
if (res[1][i+1] == Genivi.FUELSTOPADVISOR_FUEL_LEVEL) {
diff --git a/test/script/README b/test/script/README
index eb9efb2..363922d 100644..100755
--- a/test/script/README
+++ b/test/script/README
@@ -1,10 +1,21 @@
-Release date of the file: 29-07-2014
+Release date of the file: 11-08-2014
Status: to be completed
-This test bench is based on Python pygame and use python enum class.
-If necessary please do:
-sudo apt-get install python-pip python-pygame
-sudo pip install enum
+This test bench requires Python version >= 3.4 and uses pygame.
+
+How to get pygame
+It seems you need to build it, so follow this recipe:
+(thanks to Sir on http://heritagerobotics.wordpress.com/category/xubuntu-stuff/)
+cd
+sudo apt-get install mercurial
+hg clone https://bitbucket.org/pygame/pygame
+cd pygame
+sudo apt-get install python3-dev python3-numpy libsdl-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev libportmidi-dev libavformat-dev libswscale-dev libjpeg-dev libfreetype6-dev
+python3 setup.py build
+sudo python3 setup.py install
+
+You need some other packages
+sudo apt-get install python3-gobject
To test:
@@ -13,7 +24,7 @@ Launch the application without the logreplayer:
Launch the test dashboard (keyboard interface)
(the test dashboard calls the logreplayer and uses test log files)
-python simulation-dashboard.py
+python3 simulation-dashboard.py
Steps:
'i' launches initialization.log
diff --git a/test/script/configTests.py b/test/script/configTests.py
index f01717a..6a76761 100644..100755
--- a/test/script/configTests.py
+++ b/test/script/configTests.py
@@ -29,7 +29,7 @@
import subprocess,os
from subprocess import call
-PATH_LOGREPLAYER='../../bin/log-replayer/'
+PATH_LOGREPLAYER='../../bin/log-replayer/src/'
PATH_LOGFILES='../resource/'
def launch(file):
diff --git a/test/script/simulation-dashboard.py b/test/script/simulation-dashboard.py
index 80651a7..1d9b729 100644..100755
--- a/test/script/simulation-dashboard.py
+++ b/test/script/simulation-dashboard.py
@@ -24,24 +24,25 @@
* @licence end@
**************************************************************************
"""
-import sys,tty,termios,select,pygame,gobject,time,dbus,re,argparse
+import sys,tty,termios,select,pygame,gi,time,dbus,re,argparse
import pdb
from pygame.locals import *
from threading import Timer
from configTests import *
-from enum import Enum
+from enum import IntEnum
from dbus.mainloop.glib import DBusGMainLoop
from traceback import print_exc
+from gi.repository import GObject
-class Step(Enum):
+class Step(IntEnum):
START = 0
INITIALIZATION = 1
HIGH_TANK_LEVEL = 2
LOW_TANK_LEVEL = 3
END = 4
-class Genivi(Enum):
+class Genivi(IntEnum):
ENHANCEDPOSITIONSERVICE_LATITUDE = 0x0020
ENHANCEDPOSITIONSERVICE_LONGITUDE = 0x0021
ENHANCEDPOSITIONSERVICE_ALTITUDE = 0x0022
@@ -71,7 +72,7 @@ SPEED_CONVERSION = (36.0/GET_DBUS_PERIODICITY)
# Item location on the screen
STATUS_LOCATION = (100,10)
-STEP_LOCATION = (150,68)
+STEP_LOCATION = (100,68)
ENGINE_SPEED_LOCATION = (150,118)
FUEL_LEVEL_LOCATION = (150,175)
FUEL_INSTANT_CONSUMPTION_LOCATION = (150,238)
@@ -93,7 +94,7 @@ def display(string,location,fontColor,fontBackground):
def logVerbose(data,value):
if args.ver==True:
- print data,": ",value
+ print (data,": ",value)
def displayStatus(string):
display(string,STATUS_LOCATION,WHITE,BLUE)
@@ -149,7 +150,7 @@ def initDisplay():
displayVehicleSpeed('0')
displayGuidanceStatus('OFF')
displaySimulationStatus('OFF')
- displayFuelStopAdvisorWarning(' ')
+ displayFuelStopAdvisorWarning('-----')
displayFuelStopAdvisorTankDistance('-----')
displayFuelStopAdvisorEnhancedTankDistance('-----')
@@ -200,7 +201,7 @@ def getDbus():
fuelLevel = ambFuelInterface.GetLevel()
displayFuelLevel(str(int(fuelLevel[0])))
fuelInstCons = ambFuelInterface.GetInstantConsumption()
- displayFuelInstant(str(int(fuelInstCons[0])*FUEL_CONVERSION))
+ displayFuelInstant("{:.2f}".format(int(fuelInstCons[0])*FUEL_CONVERSION))
odometer = ambOdometerInterface.GetOdometer()
displayVehicleSpeed(str(int(odometer[0])*SPEED_CONVERSION))
@@ -224,15 +225,18 @@ def getDbus():
else:
displayFuelStopAdvisorEnhancedTankDistance('-----')
- displayStep( str(step) )
+ displayStep( str(step.name) )
# refresh screen
refresh()
return True
-def fuelStopAdvisorWarningHandler():
- displayFuelStopAdvisorWarning("F")
+def fuelStopAdvisorWarningHandler(destinationCantBeReached):
+ if destinationCantBeReached==True:
+ displayFuelStopAdvisorWarning('Warning')
+ else:
+ displayFuelStopAdvisorWarning('------- ')
def guidanceStatusHandler(status,handle):
if status==Genivi.NAVIGATIONCORE_ACTIVE:
@@ -283,7 +287,7 @@ dbusConnectionBus = dbus.SessionBus()
try:
ambObject = dbusConnectionBus.get_object("org.automotive.message.broker", "/")
except dbus.DBusException:
- print "connection to Automotive message broker failed"
+ print ("connection to Automotive message broker failed")
print_exc()
sys.exit(1)
ambInterface = dbus.Interface(ambObject, "org.automotive.Manager")
@@ -307,7 +311,7 @@ ambOdometerInterface = dbus.Interface(ambOdometer, "org.automotive.Odometer")
try:
fuelStopAdvisorObject = dbusConnectionBus.get_object("org.genivi.demonstrator.FuelStopAdvisor","/org/genivi/demonstrator/FuelStopAdvisor")
except dbus.DBusException:
- print "connection to Fuel Stop Advisor failed"
+ print ("connection to Fuel Stop Advisor failed")
print_exc()
sys.exit(1)
fuelStopAdvisorInterface = dbus.Interface(fuelStopAdvisorObject, "org.genivi.demonstrator.FuelStopAdvisor")
@@ -317,7 +321,7 @@ dbusConnectionBus.add_signal_receiver(fuelStopAdvisorWarningHandler, dbus_interf
try:
enhancedPositionObject = dbusConnectionBus.get_object("org.genivi.positioning.EnhancedPosition", "/org/genivi/positioning/EnhancedPosition")
except dbus.DBusException:
- print "connection to Enhanced position failed"
+ print ("connection to Enhanced position failed")
print_exc()
sys.exit(1)
enhancedPositionInterface = dbus.Interface(enhancedPositionObject, "org.genivi.positioning.EnhancedPosition")
@@ -326,7 +330,7 @@ enhancedPositionInterface = dbus.Interface(enhancedPositionObject, "org.genivi.p
try:
guidanceObject = dbusConnectionBus.get_object("org.genivi.navigationcore.Guidance","/org/genivi/navigationcore")
except dbus.DBusException:
- print "connection to Guidance failed"
+ print ("connection to Guidance failed")
print_exc()
sys.exit(1)
guidanceInterface = dbus.Interface(guidanceObject, "org.genivi.navigationcore.Guidance")
@@ -336,7 +340,7 @@ dbusConnectionBus.add_signal_receiver(guidanceStatusHandler, dbus_interface = "o
try:
mapMatchedPositionObject = dbusConnectionBus.get_object("org.genivi.navigationcore.MapMatchedPosition","/org/genivi/navigationcore")
except dbus.DBusException:
- print "connection to Map matched position failed"
+ print ("connection to Map matched position failed")
print_exc()
sys.exit(1)
mapMatchedPositionInterface = dbus.Interface(mapMatchedPositionObject, "org.genivi.navigationcore.MapMatchedPosition")
@@ -348,10 +352,10 @@ refresh()
# start
step = Step.START
-gobject.timeout_add(KEYBOARD_PERIODICITY,getKeyboard)
-gobject.timeout_add(GET_DBUS_PERIODICITY,getDbus)
+GObject.timeout_add(KEYBOARD_PERIODICITY,getKeyboard)
+GObject.timeout_add(GET_DBUS_PERIODICITY,getDbus)
-loop = gobject.MainLoop()
+loop = GObject.MainLoop()
loop.run()