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

Add the full state to step response #171

Merged
merged 3 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "Ecdar-ProtoBuf"]
path = Ecdar-ProtoBuf
url = https://github.com/Ecdar/Ecdar-ProtoBuf.git
branch = futureproof1
branch = main
2 changes: 1 addition & 1 deletion Ecdar-ProtoBuf
Submodule Ecdar-ProtoBuf updated 1 files
+4 −0 query.proto
16 changes: 13 additions & 3 deletions src/ProtobufServer/ecdar_requests/simulation_requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
services::{SimulationStartRequest, SimulationStepRequest, SimulationStepResponse},
ConcreteEcdarBackend,
},
System::specifics::SpecificDecision,
System::specifics::{SpecificDecision, SpecificState},
};

use super::request_util::simulation_info_to_transition_system;
Expand All @@ -23,13 +23,19 @@ impl ConcreteEcdarBackend {
let transition_system = simulation_info_to_transition_system(&simulation_info, &mut cache);

// Get the decisions from the initial state and convert them to proto
let initial = Decision::get_initial_decisions(&transition_system)
let decisions = Decision::get_initial_decisions(&transition_system)
.into_iter()
.map(|i| SpecificDecision::from_decision(&i, &*transition_system).into())
.collect();

let state = transition_system.get_initial_state();

let full_state =
state.map(|state| SpecificState::from_state(&state, &*transition_system).into());

Ok(SimulationStepResponse {
new_decision_points: initial,
full_state,
new_decision_points: decisions,
})
}

Expand All @@ -45,6 +51,9 @@ impl ConcreteEcdarBackend {
let system = simulation_info_to_transition_system(&simulation_info, &mut cache);

let chosen_decision = request_message.chosen_decision.unwrap();

let full_state = chosen_decision.destination.clone();

let chosen_decision = proto_decision_to_decision(chosen_decision, &system);

let decision_points = chosen_decision.resolve(&system);
Expand All @@ -55,6 +64,7 @@ impl ConcreteEcdarBackend {
.collect();

Ok(SimulationStepResponse {
full_state,
new_decision_points: decision_points,
})
}
Expand Down
Loading