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

Loop Behavior with OpenSCENARIO and routes #443

Open
heobu opened this issue Feb 5, 2020 · 8 comments · Fixed by #447
Open

Loop Behavior with OpenSCENARIO and routes #443

heobu opened this issue Feb 5, 2020 · 8 comments · Fixed by #447
Assignees
Labels
bug Something isn't working

Comments

@heobu
Copy link

heobu commented Feb 5, 2020

I would like to be able to create a loop behavior for vehicles using OpenSCENARIO. It seems like already there might be some potential solutions to this problem, but none of them seem to work so far.

In these scenarios, each vehicle has a dedicated Act describing their behavior inside one over-arching Story for all the vehicles. And inside each Act, a Sequence>Maneuver>Event>Action>Private>Routing>FollowRoute>Route is described consisting of a bunch of Waypoints so that the vehicle can follow along a given route for this scenario. Firstly, looking at the complementary support documentation for OpenSCENARIO and looking through the code, the expectation was that increasing the numberOfExecutions parameter for a Sequence tag would ensure this whole Sequence would be repeated. But, be it a Route or any other type of scenario definition, changing the numberOfExecutions parameter does not seem to have any effect whatsoever and the Sequence never gets repeated. Secondly, as an alternative to the first method, additional Events or appropriate conditions are used to create an Act in which one specific Event consisting of a Route is supposed to be triggered again and again at the end of each loop. Seemingly, even with more basic scenario definitions, an Event cannot be triggered more than once to provide this looping behavior anyway. As a result, that approach did not provide the desired result either.

Environment:

  • OS: Ubuntu 16.04
  • CARLA Version: CARLA 0.9.7
  • Scenario Runner Version: master (commit id: ffd8f8c)
@fabianoboril fabianoboril self-assigned this Feb 5, 2020
@fabianoboril fabianoboril added bug Something isn't working work in progess labels Feb 5, 2020
@fabianoboril
Copy link
Collaborator

Hi,
thanks for this hint. I could reproduce the problem. There is in fact a bug. I started looking into a solution.

@fabianoboril
Copy link
Collaborator

You can take a look into the following branch:
https://github.com/carla-simulator/scenario_runner/tree/fix/repetitions
For my quick tests it seems to fix the issues.

fabianoboril added a commit that referenced this issue Feb 6, 2020
Repetitions in OpenSCENARIO were not properly working. Reworked the repetition
handling by three major changes:
- Not copy py_tree elements, this will cause problems due to references in Python
- Replaced get_py_tree_path with get_xml_path, as the first was not working properly
- Avoid using ":" in py_tree behavior names, as this may break py_trees

Change-Id: I7829106136cd6c20e6863d1f424fbc600030bf13
fabianoboril added a commit that referenced this issue Feb 6, 2020
Repetitions in OpenSCENARIO were not properly working. Reworked the repetition
handling by three major changes:
- Not copy py_tree elements, this will cause problems due to references in Python
- Replaced get_py_tree_path with get_xml_path, as the first was not working properly
- Avoid using ":" in py_tree behavior names, as this may break py_trees

Change-Id: I7829106136cd6c20e6863d1f424fbc600030bf13
fabianoboril added a commit that referenced this issue Feb 6, 2020
Repetitions in OpenSCENARIO were not properly working. Reworked the repetition
handling by three major changes:
- Not copy py_tree elements, this will cause problems due to references in Python
- Replaced get_py_tree_path with get_xml_path, as the first was not working properly
- Avoid using ":" in py_tree behavior names, as this may break py_trees

Change-Id: I7829106136cd6c20e6863d1f424fbc600030bf13
@heobu
Copy link
Author

heobu commented Feb 10, 2020

Hi. This fix seems really helpful and indeed now you can see the vehicles attempting to repeat the same behavior. Except the fact that when it is used in a Sequence involving Routing>FollowRoute>Route. Because now the vehicle will complete the first loop, slow down and stop, make a small loop to go back a bit and start the second loop only then. As a result, the transition between these repetitions is awkward and has some extra undefined behavior.

fabianoboril added a commit that referenced this issue Feb 10, 2020
Repetitions in OpenSCENARIO were not properly working. Reworked the repetition
handling by three major changes:
- Not copy py_tree elements, this will cause problems due to references in Python
- Replaced get_py_tree_path with get_xml_path, as the first was not working properly
- Avoid using ":" in py_tree behavior names, as this may break py_trees

Change-Id: I7829106136cd6c20e6863d1f424fbc600030bf13
@heobu
Copy link
Author

heobu commented Feb 10, 2020

A small addition to my previous comment: This is at least the case with a Speed parameter set using ParameterDeclaration. Without a speed set, so far it seems to be working in repeating Sequences with smooth transitions in between.

@heobu
Copy link
Author

heobu commented Feb 10, 2020

Another point: In a case where multiple cars are following their Routes under one over-arching Story, when the Ego car (hero) completes its loop, the other cars start behaving strangely and lose their way for a bit as the Ego vehicle is said to be reset and destroyed:

Resetting ego-vehicle!
Destroying ego-vehicle!

Visually, the Ego vehicle does not seem to be disappearing between these loops anyway, and in between these repetitions for the Ego vehicle, it seems like maybe the other cars are trying to find their way again to possibly continue following their original route. But somehow, the Ego vehicle completing 1 execution of a Sequence has some sort of side-effect on the other vehicles. (Those other cars are yet to complete their loops at that point.)

@fabianoboril
Copy link
Collaborator

Hi,
the last of your posts refers to the CARLA LocalPlanner:
https://github.com/carla-simulator/carla/blob/94dab0c4d7e16d349a0c2ff8d205cf546ad32cca/PythonAPI/carla/agents/navigation/local_planner.py#L91
This creates this not-so-nice debug output. You can ignore it, or file an issue at CARLA.

We are currently performing the review for the PR, and plan to merge it. We will look into the problem with the speed parameter afterwards.

fpasch pushed a commit that referenced this issue Feb 10, 2020
Repetitions in OpenSCENARIO were not properly working. Reworked the repetition
handling by three major changes:
- Not copy py_tree elements, this will cause problems due to references in Python
- Replaced get_py_tree_path with get_xml_path, as the first was not working properly
- Avoid using ":" in py_tree behavior names, as this may break py_trees

Change-Id: I7829106136cd6c20e6863d1f424fbc600030bf13
@fabianoboril fabianoboril reopened this Feb 10, 2020
@heobu
Copy link
Author

heobu commented Feb 10, 2020

Hi,

About the last point on the local planner, the issue is not that there is a debug output being printed by it, it’s that once a vehicle is finished with following its route, all the other vehicles seem to get confused about their own route. This seems more of an issue with waypoint following or scenario management actually.

@fabianoboril
Copy link
Collaborator

If all are using the same local planner module, this is as I explained above. Do you see this also when using different routes for different vehicles?

@fabianoboril fabianoboril changed the title Loop Behavior with OpenSCENARIO Loop Behavior with OpenSCENARIO and routes Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants