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

Reset started flag #656

Merged
merged 2 commits into from
Oct 29, 2024
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 atos/modules/EsminiAdapter/src/esminiadapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ void EsminiAdapter::reportObjectPosition(const Monitor::message_type::SharedPtr
*/
void EsminiAdapter::onMonitorMessage(const Monitor::message_type::SharedPtr monr, uint32_t ATOSObjectId) {
if (auto idMapping = atosIdToEsminiId.find(ATOSObjectId); idMapping != atosIdToEsminiId.end()) {
reportObjectPosition(monr, idMapping->first); // Report object position to esmini
reportObjectPosition(monr, idMapping->second); // Report object position to esmini
SE_Step(); // Advance the "simulation world"-time
}
else {
Expand Down
8 changes: 6 additions & 2 deletions atos/modules/OpenScenarioGateway/openscenariogateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def __init__(self):

# ROS subscriptions/publishers
self.init_ = self.create_subscription(Empty, "init", self.init_callback, 10)
self.arm_ = self.create_subscription(Empty, "arm", self.arm_callback, 10)

self.story_board_element_sub_ = self.create_subscription(
atos_interfaces.msg.StoryBoardElementStateChange,
Expand Down Expand Up @@ -93,6 +94,11 @@ def init_callback(self, msg):
self.get_parameter(ACTIVE_OBJECT_NAME_PARAMETER).value
)

def arm_callback(self, msg):
# Reset the started flag
for id in self.active_objects:
self.active_objects[id].started = False

def story_board_element_state_change_callback(self, story_board_element):
if (
story_board_element.name in self.start_actions_to_obj_name.keys()
Expand Down Expand Up @@ -185,8 +191,6 @@ def update_active_scenario_objects(self, active_objects_name: List[str]):
obj.name, id
)
)
# Reset the started flag
obj.started = False

def get_all_objects_in_scenario(self, scenario_file) -> List[ScenarioObject]:
scenario = xosc.ParseOpenScenario(scenario_file)
Expand Down
Loading