From 33b7cffdfcf2322f5a7d081a827cbbf3122b098a Mon Sep 17 00:00:00 2001 From: asanoaozora Date: Tue, 22 Aug 2017 11:22:42 +0200 Subject: GT-3529 missing comments in the franca definition of the mapmatchedposition interface --- .../navigationcore/MapMatchedPosition.fidl | 66 +++++++++++-------- .../genivi_navigationcore_mapmatchedposition.cxx | 77 +++++++++++++++------- src/navigation/update_third_party.sh | 1 - test/navigation/script/lbs-api-test.e4p | 3 +- 4 files changed, 93 insertions(+), 54 deletions(-) diff --git a/api/franca/navigation/navigationcore/MapMatchedPosition.fidl b/api/franca/navigation/navigationcore/MapMatchedPosition.fidl index 5a72b20..79cdc73 100644 --- a/api/franca/navigation/navigationcore/MapMatchedPosition.fidl +++ b/api/franca/navigation/navigationcore/MapMatchedPosition.fidl @@ -12,6 +12,14 @@ import org.genivi.navigation.navigationcore.NavigationCoreTypes.* from "Navigati <** @description : MapMatchedPosition = This interface offers functions to retrieve the map matched position and to simulate positioning + If NavigationCore is not in Simulation Mode (Simulation Status is SIMULATION_STATUS_NO_SIMULATION), it is using the EnhancedPosition from the Positioning component. + In Simulation Mode it is not using this position, instead it uses FixedPosition or FollowActiveRoute to determine the position. + With FixedPosition (Simulation Status is SIMULATION_STATUS_FIXED_POSITION), the position is fixed, unless it is changed by a call to setPosition(). + This supports use cases like: setting the current car position in a demo mode, or replay a position log file (where setPosition() is called for each logged location). + In Follow Active Route mode, NavigationCore is generating positions itself. + These positions follow the current active route. When the end of the route is reached, the position jumps back to the starting point of the route. + There are two sub states: Running (Simulation Status is SIMULATION_STATUS_RUNNING) and Paused (Simulation Status is SIMULATION_STATUS_PAUSED). + By default the ‘driving speed’ will be equal to the free flow speed of each road segment. However a speed factor can be set via the method SetSimulationSpeed. **> interface MapMatchedPosition { @@ -29,31 +37,31 @@ interface MapMatchedPosition { enumeration AddressItemKey extends TimeStampedEnum { TIMEZONE_OFFSET = 17 DAYLIGHT_OFFSET = 18 - COUNTRY = 166 //Base 0x00a0 - STATE = 167 - CITY = 168 - STREET = 170 - HOUSENUMBER = 171 - CROSSING = 172 - DISTRICT = 173 - PHONENUMBER = 174 - POINAME = 175 - TOWNCENTER = 176 + COUNTRY = 166 //Base 0x00a0 + STATE = 167 + CITY = 168 + STREET = 170 + HOUSENUMBER = 171 + CROSSING = 172 + DISTRICT = 173 + PHONENUMBER = 174 + POINAME = 175 + TOWNCENTER = 176 LOCATION_INPUT = 177 FULL_ADDRESS = 178 - COUNTRYCODE = 179 - HOUSENAME = 180 - POSTAL_CODE = 181 - ROAD_NUMBER = 334 - MATCH_TYPE = 240 - ROADSHIELDS = 182 + COUNTRYCODE = 179 + HOUSENAME = 180 + POSTAL_CODE = 181 + ROAD_NUMBER = 334 + MATCH_TYPE = 240 + ROADSHIELDS = 182 } enumeration PositionStatus extends GeoLocalizedEnum { //Base 0x00e0 - GNSS_FIX_STATUS = 224 + GNSS_FIX_STATUS = 224 DR_STATUS = 225 MM_STATUS = 226 - SIMULATION_MODE = 227 + SIMULATION_MODE = 227 } enumeration MatchMode { //Base 0x00f0 @@ -73,16 +81,16 @@ interface MapMatchedPosition { } enumeration PositionOnSegmentKey extends TimeStampedEnum { //Base 0x0110 - SEGMENT_ID = 272 - DIRECTION_ON_SEGMENT = 274 + SEGMENT_ID = 272 + DIRECTION_ON_SEGMENT = 274 DISTANCE_ON_SEGMENT = 275 } enumeration SimulationStatus extends BasicEnum { //Base 0x0220 - SIMULATION_STATUS_NO_SIMULATION = 544 - SIMULATION_STATUS_RUNNING = 545 - SIMULATION_STATUS_PAUSED = 546 - SIMULATION_STATUS_FIXED_POSITION = 547 + SIMULATION_STATUS_NO_SIMULATION = 544 //means that NavigationCore is using the EnhancedPosition + SIMULATION_STATUS_RUNNING = 545 //means that positions are generated along the active route + SIMULATION_STATUS_PAUSED = 546 //means that the generation of positions along the active route is paused + SIMULATION_STATUS_FIXED_POSITION = 547 //means that the position is fixed } union PositionItemValue { @@ -179,7 +187,7 @@ interface MapMatchedPosition { Handle sessionHandle <** - @description : speedFactor = speed factor + @description : speedFactor = speed factor. unit is x0.25. Normal speed x1 is 4 **> UInt8 speedFactor } @@ -200,6 +208,8 @@ interface MapMatchedPosition { <** @description : startSimulation = This method starts, or resumes, a Follow Active Route simulation + If the current Simulation Status is SIMULATION_STATUS_PAUSED, the simulation is resumed from the current location. + Otherwise the simulation is started from the starting point of the route. In both cases the new status will be SIMULATION_STATUS_RUNNING **> method startSimulation { in { @@ -242,6 +252,9 @@ interface MapMatchedPosition { <** @description : setPosition = This method sets the position to a specific location + Independent of the current Simulation Status, the new status will be SIMULATION_STATUS_FIXED_POSITION. + This method can be used to replay a position log file (with positions obtained via calls to GetPosition()) by calling this method for each position in the log file. + It is of course also possible to call this method just once with e.g. a 'current location' entered by the user (via the HMI). **> method setPosition { in { @@ -311,6 +324,7 @@ interface MapMatchedPosition { <** @description : simulationSpeedChanged = This signal is emitted when the simulation speed factor has changed + NavigationCore will only send out a SimulationSpeedChanged signal if there is at least one node listening to these changes **> broadcast simulationSpeedChanged selective { out { @@ -375,4 +389,4 @@ interface MapMatchedPosition { Int32 direction } } -} \ No newline at end of file +} diff --git a/src/navigation/navigation-core/mapmatchedposition-plugin/genivi_navigationcore_mapmatchedposition.cxx b/src/navigation/navigation-core/mapmatchedposition-plugin/genivi_navigationcore_mapmatchedposition.cxx index 5b6f782..2bb2093 100644 --- a/src/navigation/navigation-core/mapmatchedposition-plugin/genivi_navigationcore_mapmatchedposition.cxx +++ b/src/navigation/navigation-core/mapmatchedposition-plugin/genivi_navigationcore_mapmatchedposition.cxx @@ -129,7 +129,8 @@ class MapMatchedPosition MapMatchedPosition(DBus::Connection &connection) : DBus::ObjectAdaptor(connection, "/org/genivi/navigationcore") { - } + m_position_set=false; + } ::DBus::Struct< uint16_t, uint16_t, uint16_t, std::string > GetVersion() @@ -146,28 +147,51 @@ class MapMatchedPosition GetPosition(const std::vector< int32_t >& valuesToReturn, int32_t& error, std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > >& position) { LOG_INFO_MSG(gCtx,"Get position"); - struct attr attr; - for (int i = 0 ; i < valuesToReturn.size() ; i++) { - switch (valuesToReturn[i]) { - case GENIVI_NAVIGATIONCORE_LATITUDE: - if (tracking_get_attr(tracking, attr_position_coord_geo, &attr, NULL)) - position[GENIVI_NAVIGATIONCORE_LATITUDE]._2=variant_double(attr.u.coord_geo->lat); - break; - case GENIVI_NAVIGATIONCORE_LONGITUDE: - if (tracking_get_attr(tracking, attr_position_coord_geo, &attr, NULL)) - position[GENIVI_NAVIGATIONCORE_LONGITUDE]._2=variant_double(attr.u.coord_geo->lng); - break; - case GENIVI_NAVIGATIONCORE_SPEED: - if (tracking_get_attr(tracking, attr_position_speed, &attr, NULL)) - position[GENIVI_NAVIGATIONCORE_SPEED]._2=variant_double(*attr.u.numd); - break; - case GENIVI_NAVIGATIONCORE_HEADING: - if (tracking_get_attr(tracking, attr_position_direction, &attr, NULL)) - position[GENIVI_NAVIGATIONCORE_HEADING]._2=variant_double(*attr.u.numd); - break; - } - } - error=0; //not implemented yet + if(simulationMode==GENIVI_NAVIGATIONCORE_SIMULATION_STATUS_FIXED_POSITION){ + if(m_position_set){ + for (int i = 0 ; i < valuesToReturn.size() ; i++) { + switch (valuesToReturn[i]) { + case GENIVI_NAVIGATIONCORE_LATITUDE: + position[GENIVI_NAVIGATIONCORE_LATITUDE]=m_position[GENIVI_NAVIGATIONCORE_LATITUDE]; + break; + case GENIVI_NAVIGATIONCORE_LONGITUDE: + position[GENIVI_NAVIGATIONCORE_LONGITUDE]=m_position[GENIVI_NAVIGATIONCORE_LONGITUDE]; + break; + case GENIVI_NAVIGATIONCORE_SPEED: + position[GENIVI_NAVIGATIONCORE_SPEED]=m_position[GENIVI_NAVIGATIONCORE_SPEED]; + break; + case GENIVI_NAVIGATIONCORE_HEADING: + position[GENIVI_NAVIGATIONCORE_HEADING]=m_position[GENIVI_NAVIGATIONCORE_HEADING]; + break; + } + } + error=GENIVI_NAVIGATIONCORE_OK; + } + else error=GENIVI_NAVIGATIONCORE_NO_POSITION; //setposition has not been invoked, so vehicle is nowhere + }else{ + struct attr attr; + for (int i = 0 ; i < valuesToReturn.size() ; i++) { + switch (valuesToReturn[i]) { + case GENIVI_NAVIGATIONCORE_LATITUDE: + if (tracking_get_attr(tracking, attr_position_coord_geo, &attr, NULL)) + position[GENIVI_NAVIGATIONCORE_LATITUDE]._2=variant_double(attr.u.coord_geo->lat); + break; + case GENIVI_NAVIGATIONCORE_LONGITUDE: + if (tracking_get_attr(tracking, attr_position_coord_geo, &attr, NULL)) + position[GENIVI_NAVIGATIONCORE_LONGITUDE]._2=variant_double(attr.u.coord_geo->lng); + break; + case GENIVI_NAVIGATIONCORE_SPEED: + if (tracking_get_attr(tracking, attr_position_speed, &attr, NULL)) + position[GENIVI_NAVIGATIONCORE_SPEED]._2=variant_double(*attr.u.numd); + break; + case GENIVI_NAVIGATIONCORE_HEADING: + if (tracking_get_attr(tracking, attr_position_direction, &attr, NULL)) + position[GENIVI_NAVIGATIONCORE_HEADING]._2=variant_double(*attr.u.numd); + break; + } + } + error=GENIVI_NAVIGATIONCORE_OK; + } } void @@ -223,8 +247,9 @@ class MapMatchedPosition void SetPosition(const uint32_t& sessionHandle, const std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > >& position) { - throw DBus::ErrorNotSupported("Not yet supported"); - } + m_position_set=true; + m_position=position; + } void StartSimulation(const uint32_t& sessionHandle) @@ -288,6 +313,8 @@ class MapMatchedPosition return vehicle_speed.u.num*4/40; } + bool m_position_set; + std::map< int32_t, ::DBus::Struct< uint8_t, ::DBus::Variant > > m_position; }; static void diff --git a/src/navigation/update_third_party.sh b/src/navigation/update_third_party.sh index a8b0dab..784f8b6 100755 --- a/src/navigation/update_third_party.sh +++ b/src/navigation/update_third_party.sh @@ -1,6 +1,5 @@ #!/bin/bash -build_option="" positioning_version='9725fe1f553197042d6445997690d452a73490c0' navit_version='28478e7f26c1a0eedc06fb4765e2f736079c6f0c' diff --git a/test/navigation/script/lbs-api-test.e4p b/test/navigation/script/lbs-api-test.e4p index e321337..45e2b76 100644 --- a/test/navigation/script/lbs-api-test.e4p +++ b/test/navigation/script/lbs-api-test.e4p @@ -1,7 +1,7 @@ - + en_US @@ -21,7 +21,6 @@ test-address-input.py test-map-viewer-control.py test-location-input.py - test-map-viewer-control-single.py test-route-calculation.py genivi.py -- cgit v1.2.1