Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Verbal Succinct Transition Instruction #2844

Closed
wants to merge 55 commits into from

Conversation

kdiluca
Copy link
Member

@kdiluca kdiluca commented Feb 8, 2021

Description

Added logic to directions.proto, maneuver, maneuvers_builder and narrative_builder for a verbal succinct transition instruction.

Issue

What issue is this PR targeting? If there is no issue that addresses the problem, please open a corresponding issue and link it here.

Tasklist

  • Add tests
  • Add #fixes with the issue number that this PR addresses
  • Update the docs with any new request parameters or changes to behavior described
  • Update the changelog

Requirements / Relations

Link any requirements here. Other pull requests this PR is based on?

src/odin/maneuversbuilder.cc Outdated Show resolved Hide resolved
}

std::string NarrativeBuilder::FormVerbalSuccinctDestinationTransitionInstruction(Maneuver& maneuver) {
// "0": "You have arrived at your destination."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance this can be even more succinct, You have arrived.?

@kdiluca
Copy link
Member Author

kdiluca commented Feb 9, 2021

1: Drive north on Carretera de Sant Carles. | 0.2 mi
   VERBAL_SUCCINCT: Drive north.
   VERBAL_PRE: Drive north on Carretera de Sant Carles. Then Turn left onto Carretera de Santa Agnès de Malanyanes al Coll.
   VERBAL_POST: Continue for 900 feet.
----------------------------------------------
2: Turn left onto Carretera de Santa Agnès de Malanyanes al Coll. | 0.1 mi
   VERBAL_SUCCINCT: Turn left.
   VERBAL_ALERT: Turn left onto Carretera de Santa Agnès de Malanyanes al Coll.
   VERBAL_PRE: Turn left onto Carretera de Santa Agnès de Malanyanes al Coll.
   VERBAL_POST: Continue for 700 feet.
----------------------------------------------
3: Turn left to stay on Carretera de Santa Agnès de Malanyanes al Coll. | 0.6 mi
   VERBAL_SUCCINCT: Turn left.
   VERBAL_ALERT: Turn left to stay on Carretera de Santa Agnès de Malanyanes al Coll.
   VERBAL_PRE: Turn left to stay on Carretera de Santa Agnès de Malanyanes al Coll.
   VERBAL_POST: Continue for a half mile.
----------------------------------------------
4: Your destination is on the left. | 0.0 mi
   VERBAL_SUCCINCT: You have arrived at your destination.
   VERBAL_ALERT: Your destination will be on the left.
   VERBAL_PRE: Your destination is on the left.
==============================================
Total time: 3 minutes
Total length: 0.9 mi

@dgearhart
Copy link
Member

VERBAL_SUCCINCT: You have arrived at your destination.

We will have to discuss this one

@kdiluca
Copy link
Member Author

kdiluca commented Feb 10, 2021

VERBAL_SUCCINCT: You have arrived at your destination.

We will have to discuss this one

We have quite a few we need to discuss 😄

@kdiluca kdiluca requested a review from dgearhart February 16, 2021 15:52
void ManeuversBuilder::ProcessVerbalSuccinctTransitionInstruction(std::list<Maneuver>& maneuvers) {
for (auto& maneuver : maneuvers) {
if (maneuver.HasStreetNames()) {
std::string street_name = maneuver.street_names().front()->value();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update to look at word count that matches kVerbalPreElementMaxCount

return instruction;
}

std::string NarrativeBuilder::FormVerbalSuccinctDestinationTransitionInstruction() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove for now

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to leave for now since we discussed this.

/////////////////////////////////////////////////////////////////////////////
std::string FormVerbalSuccinctStartTransitionInstruction(Maneuver& maneuver);

std::string FormVerbalSuccinctDestinationTransitionInstruction();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove for now

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to leave for now since we discussed this.

@@ -79,7 +79,7 @@ void NarrativeBuilder::Build(std::list<Maneuver>& maneuvers) {

// Set verbal succinct transition instruction
maneuver.set_verbal_succinct_transition_instruction(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the string is large then we will want to set the succinct to either phrase 0 or 2

  // "0": "You have arrived at your destination."
  // "2": "Your destination is on the <RELATIVE_DIRECTION>."

Otherwise, we do not want to set succinct instruction for the destination maneuver

@@ -538,7 +546,8 @@ TEST(Instructions, validate_obvious_maneuver_instructions) {
"test/pinpoints/instructions/obvious_maneuver_short_continue.pbf"},
expected_routes_size, expected_legs_size, expected_maneuvers_size, maneuver_index,
"Take the PA 39 West/Hersheypark Drive exit toward Attractions.",
"Take the exit.", "Take the Pennsylvania 39 West exit.",
"Take the Pennsylvania 39 West, Hersheypark Drive exit toward Attractions.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not look right - maybe for initial implementation, concentrate on maneuvers that are impacted by long street name - what are your thoughts?

@@ -206,6 +225,10 @@ void NarrativeBuilder::Build(std::list<Maneuver>& maneuvers) {
// Set stay on instruction
maneuver.set_instruction(FormKeepToStayOnInstruction(maneuver));

// Set verbal succinct transition instruction
maneuver.set_verbal_succinct_transition_instruction(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove for now

@@ -308,6 +347,10 @@ void NarrativeBuilder::Build(std::list<Maneuver>& maneuvers) {
// Set instruction
maneuver.set_instruction(FormEnterFerryInstruction(maneuver));

// Set verbal succinct transition instruction
maneuver.set_verbal_succinct_transition_instruction(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove for now

}

std::string
NarrativeBuilder::FormVerbalSuccinctKeepTransitionInstruction(Maneuver& maneuver,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove for now

}

std::string
NarrativeBuilder::FormVerbalSuccinctEnterFerryTransitionInstruction(Maneuver& maneuver,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove for now

@@ -964,6 +966,7 @@ void expect_instructions_at_maneuver_index(
const valhalla::Api& result,
int maneuver_index,
const std::string& expected_text_instruction,
const std::string& expected_verbal_succinct_transition_instruction,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably not needed until - maybe only after focused gurka test are complete

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably not needed until - maybe only after focused gurka test are complete

or leave in if it is easier to just fix the tests after code is complete

@kdiluca kdiluca mentioned this pull request Jun 4, 2021
5 tasks
@kdiluca
Copy link
Member Author

kdiluca commented Jun 4, 2021

Closing and opened new rebased PR #3128

@kdiluca kdiluca closed this Jun 4, 2021
@nilsnolde nilsnolde deleted the kdiluca-long-streetnames branch February 24, 2024 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants