Coder Social home page Coder Social logo

carla-simulator / scenario_runner Goto Github PK

View Code? Open in Web Editor NEW
490.0 26.0 353.0 167.44 MB

Traffic scenario definition and execution engine

Home Page: https://carla-scenariorunner.readthedocs.io/en/latest/

License: MIT License

Python 85.61% Shell 0.03% XSLT 3.72% Dockerfile 0.07% Java 9.63% ANTLR 0.94%
carla traffic-scenario openscenario

scenario_runner's People

Contributors

alecgrover avatar amstrudy avatar bhaprayan avatar daraan avatar dsche avatar fabianoboril avatar felipecode avatar fpasch avatar fred-labs avatar germanros1987 avatar glopezdiest avatar matthewcoyle-cpc avatar mattroweeaif avatar melviso-osvf avatar mohit-awana avatar msiam avatar pablovd avatar pravinblaze avatar pvgladkov avatar repa1030 avatar sagar-g-v avatar seowwj avatar shreyadey23 avatar stonier avatar subhashiniperumal avatar sumza avatar thisisfrey avatar xiaofei9704 avatar yaknostoyok avatar yougmark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scenario_runner's Issues

Resolve python requirements for scenario_runner

The current docs state that scenario runner is designed to run on either python 2.7 or 3.5+, but this doesn't seem to be totally true. For example, the challenge evaluator will not run with python 2.7 (see #70). It looks like the code and the docs are inconsistent, so one or both need to be updated. I am happy to contribute either way, I would just need to know what the intended requirements are.

AttributeError: module 'carla' has no attribute 'Transform'

When trying to execute python scenario_runner.py --scenario FollowLeadingVehicle
got the error below

Traceback (most recent call last):
File "scenario_runner.py", line 22, in
from Scenarios.follow_leading_vehicle import *
File "/home/deepaknayak/Documents/Reinforcement-learning/scenario_runner-master/Scenarios/follow_leading_vehicle.py", line 30, in
class FollowLeadingVehicle(BasicScenario):
File "/home/deepaknayak/Documents/Reinforcement-learning/scenario_runner-master/Scenarios/follow_leading_vehicle.py", line 44, in FollowLeadingVehicle
_ego_vehicle_start = carla.Transform(
AttributeError: module 'carla' has no attribute 'Transform'

failed to get world settings

I test carla with scenario_runner, but I found some problems.
When I try

python3 scenario_runner.py --scenario MasterScenario

it failed because of

AttributeError: 'World' object has no attribute 'get_settings'

it happens in all scenarios

Screenshot from 2019-04-09 22-11-06

set velocity in scenatio runner

Hi,

Is it possible to set velocity under autopilot in scenario runner?
I also would like to get the velocity data through the scenario in sample time interval of the vehicles and actors, is that possible?

Thanks a lot!

Error while following Getting Started doc

Hi, I just followed all the steps in the Getting Started documentation, but it prompts errors again and again after running scenario_runner.py. The message was "Timestamp does not have any field named frame" and it was in srunner/scenariomanager/timer.py. I already installed Python packages, set the Python path, and everything. I looked into the code and found out there is timestamp.frame in manual_control.py, which worked fine after the server was up. Did I miss any steps?

scenario_runner.py: IndexError: blueprint 'sensor.other.lane_detector' not found

Hello,

Just trying to run the latest master branch of scenario_runner and I get the following error message:
"""
...
IndexError: blueprint 'sensor.other.lane_detector' not found
blueprint 'sensor.other.lane_detector' not found
No more scenarios .... Exiting
"""

Currently using carla 0.9.5. Any suggestion how to fix it?

Cheers

Unable to spawn actors in scenario_runner: after pull

HI,

carla version: 0.9.5
python version: 3.5.2

I am able to connect to carla server via manual_control.py and it spawning the ego vehicle.

But for new changes of scenario runner, I am facing following errors.

1. After taking pull of scenario runner branch, getting following error:

Selection_002

2. From CarlaActorPool._world.try_spawn_actor() not able to spawn the actors into carla.

  1. Carla server is running as docker container with Town01 map

Selection_003

Selection_004

The scenario cannot be loaded?

Hello.
when I run python scenario_runner.py --scenario FollowLeadingVehicle_1,I receive the following message:
Preparing scenario: FollowLeadingVehicle_1 The scenario cannot be loaded global name 'LocalPlanner' is not defined No more scenarios .... Exiting
How I should solved it?

Failed to localize before lane change

Hi,

Using the scenario runner, I wrote a lane merge scenario class to execute other vehicle merging into the ego vehicle lane
I wrote a script where other_actor merges with ego vehicle lane after moving ahead using BasicAgent class. It shows a warning

failed to Localize!: 54 -3

Could you explain why this happens before lane change over?

Also, a general question. Why do we always get this "resetting ego-vehicle" message on the screen?

Thanks,
Deepak

Synchronous Mode

Dear All,

I would like to ask, if it is possible to run the scenarios in the synchronous mode.

If it is possible, which modifications should be done to the manual_control.py to do so.

If there is an example already done it will be so helpful.

Thanks.

scenario_runner.py: IndexError: attribute 'role_name' not found

Running Carla 0.9.1 in docker instance
docker run -p 2000-2002:2000-2002 --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=0 carlasim/carla:0.9.1 /bin/bash CarlaUE4.sh /Game/Carla/Maps/Town01

Running scenario_runner in a virtualenv
With PythonAPI version carla-0.9.1-py2.7-linux-x86_64.egg

When I want to test the FollowLeadingVehicle scenario I get the following error.
(carla_scenario_runner) peter@alienware:~/Carla/scenario_runner$ python scenario_runner.py --scenario FollowLeadingVehicle Traceback (most recent call last): File "scenario_runner.py", line 134, in <module> main(args) File "scenario_runner.py", line 80, in main scenario = scenario_class(world, args.debug) File "/home/peter/Carla/scenario_runner/Scenarios/follow_leading_vehicle.py", line 68, in __init__ self.other_vehicle_start)] File "/home/peter/Carla/scenario_runner/Scenarios/basic_scenario.py", line 32, in setup_vehicle blueprint.set_attribute('role_name', 'scenario') IndexError: attribute 'role_name' not found

Unfortunately I do not have clue what this might cause since manual_control.py seems to be working which is also using the attribute role_name but does not seem to get this error. Has the current master 662bfef been tested with Carla 0.9.1?

How to return the timestamp with the returned values

Dear All,

I modified the KeepVelocity class to save the values of the location, acceleration, velocities of the 2 cars in NoSignalJunctionScenario. However, I want to return the values accompanied with the timestamp where these values occurred.

Any ideas how to do that.

Thanks.

Policy of starting vehicles underground

I am a bit concerned with the policy of starting vehicles underground. It doesn't
seem to be very solid since CARLA, on many parts, have underground structures.
Either we try something else or we have to re-select the other vehicles start positions
considering that there can be underground structures.

Problem with repeated use of waypointFollower behavior

Hi,

In "FollowLeadingVehicleWithObstacle" class, the WaypointFollower atomic behavior is used in two instances for same actor which causes the problem of vehicle looping back

stop_near_intersection.add_child(WaypointFollower(self.other_actors[0], 35))
stop_near_intersection.add_child(InTriggerDistanceToNextIntersection(self.other_actors[0], 20))
driving_to_next_intersection.add_child(WaypointFollower(self.other_actors[0], self._first_actor_speed))
driving_to_next_intersection.add_child(InTriggerDistanceToVehicle(self.other_actors[1],
self.other_actors[0], 15))

ImportError: No module named agents.navigation.roaming_agent

OS: Ubuntu 18.04
Python: 2.7
I'm trying to run the : python scenario_runner.py


Traceback (most recent call last):
  File "scenario_runner.py", line 25, in <module>
    from Scenarios.follow_leading_vehicle import *
  File "/home/cienet/scenario_runner/Scenarios/follow_leading_vehicle.py", line 24, in <module>
    from ScenarioManager.atomic_scenario_behavior import *
  File "/home/cienet/scenario_runner/ScenarioManager/atomic_scenario_behavior.py", line 20, in <module>
    from agents.navigation.roaming_agent import *
ImportError: No module named agents.navigation.roaming_agent

Here is my pip list:

Package       Version
------------- -------
asn1crypto    0.24.0 
carla         0.9.2  
coverage      4.5.2  
cryptography  2.1.4  
decorator     4.1.2  
enum34        1.1.6  
funcsigs      1.0.2  
idna          2.6    
ipaddress     1.0.17 
keyring       10.6.0 
keyrings.alt  3.0    
mock          2.0.0  
networkx      1.11   
nose2         0.8.0  
numpy         1.13.3 
pbr           5.1.2  
pip           19.0.1 
pkg-resources 0.0.0  
py-trees      0.8.3  
pycrypto      2.6.1  
pydot         1.4.1  
pygame        1.9.4  
pygobject     3.26.1 
pyparsing     2.3.1  
pyxdg         0.25   
PyYAML        3.12   
SecretStorage 2.3.1  
setuptools    40.7.3 
six           1.12.0 
wheel         0.32.3 

Please kindly help me out, if I missed to install any dependencies?
Thank you .

Vehicles do not move

Vehicles are spawned but do not move. No obvious errors. Has anyone encountered the same?

Update: Used the wrong manual_control.py file. Everything is fine now.

Update the Getting Started documentation?

As scenario runner now supports 0.9.5, the Getting Started file should also be updated to reflect the changes required. I needed to add ${CARLA_ROOT}/PythonAPI/carla/agents/ to the PYTHONPATH to make it work.

Also, the scenario's now need to be called differently as the XML files have been updated I suppose.
Earlier python scenario_runner.py --scenario FollowLeadingVehicle used to work but now I had to use python scenario_runner.py --scenario FollowLeadingVehicle_1.

Scenario Loads & Runs but ego vehicle does not move. Condition not satisifed

Am I missing something?
Carla 9.2, Town 03, Scenario - OppositeVehicleRunningRedLight

Scenario loads and starts fine. Vehicles spawn etc.
Ego vehicle has no velocity, so other vehicle does not move and jump the red light.
Is there a key press to start the scenario or are you expecting to interface to a real AV or AV model that provides a velocity?

NameError: name 'challenge_evaluator' is not defined

I installed successfully the Challenge Evaluator using ./setup_environment.sh --carla-root <path_to_the_CARLA_root_folder> and test python srunner/challenge/challenge_evaluator.py --list which gives me:

Currently the following scenarios are supported:
NoSignalJunctionCrossing
Challenge_Basic_00
Challenge_Basic_01
Challenge_Basic_03
Challenge_Basic_04
StationaryObjectCrossing
DynamicObjectCrossing
FollowLeadingVehicle
FollowLeadingVehicleWithObstacle
ControlLoss
OppositeVehicleRunningRedLight
VehicleTurningRight
VehicleTurningLeft

trying to run with python3 gives me error such as :

Traceback (most recent call last):
  File "srunner/challenge/challenge_evaluator.py", line 23, in <module>
    import carla
  File "/home/overlapjho/carla/PythonAPI/carla-0.9.3-py2.7-linux-x86_64.egg/carla/__init__.py", line 7, in <module>
  File "/home/overlapjho/carla/PythonAPI/carla-0.9.3-py2.7-linux-x86_64.egg/carla/libcarla.py", line 7, in <module>
  File "/home/overlapjho/carla/PythonAPI/carla-0.9.3-py2.7-linux-x86_64.egg/carla/libcarla.py", line 6, in __bootstrap__
  File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: /home/overlapjho/.python-eggs/carla-0.9.3-py2.7-linux-x86_64.egg-tmp/carla/libcarla.so: undefined symbol: PyString_Type

So when I execute bash srunner/challenge/run_evaluator.sh or python srunner/challenge/challenge_evaluator.py --scenario group:ChallengeBasic -a srunner/challenge/autoagents/DummyAgent.py it throws me this error:

  File "srunner/challenge/challenge_evaluator.py", line 509, in <module>
    del challenge_evaluator
NameError: name 'challenge_evaluator' is not defined```
Help please

Lane-changing scenario

Hi, the scenario runner for Carla is very useful to benchmark a new algorithm. Many thanks to you guys. @nsubiron @felipecode
I was wondering, is there any lane-changing scenario in the scenario runner? I could't find it in the carla challenge branch.

Wrong behavior in object_crash_vehicle scenario

We have detected an error in object_crash_vehicle

The reference to derive the location of the adversaries is obtained via self.ego_vehicle.

lane_width = self._reference_waypoint.lane_width
location, _ = get_location_in_distance(self.ego_vehicle, _start_distance)
waypoint = self._wmap.get_waypoint(location)

However, this is incorrect for all those cases where the ego_vehicle is still far away from the scenario. The correct object would be config.ego_vehicle, which despite its horribly misleading name refers to the trigger position of the scenario.

I would advise to:

  • Change the parser to assign the right name to this field, i.e., scenario_trigger_location
  • Fix this behavior

[0.9.4] save_to_disk sometimes produces corrupted images

I've encountered some weird behavior of save_to_disk method (from carla.Image class)
It seems like a half of all captured images are corrupted.

My modification

The only thing I did was adding this line (srunner/challenge/envs/sensor_interface.py)
image

Logs

Nautilus image browser:

Could not load image '00192743.png'.
Fatal error reading PNG image file: IDAT: CRC error

image

image

Solution ideas

Is anybody with same issues? Maybe save_to_disk is called to often?
What about adding reading_frequency to sensor.camera.rgb or threaded callback?

The scenario cannot be loaded?

Hello.
when I run python scenario_runner.py --scenario FollowLeadingVehicle_1,I receive the following message:
Preparing scenario: FollowLeadingVehicle_1 The scenario cannot be loaded global name 'LocalPlanner' is not defined No more scenarios .... Exiting
How I should solved it?

Problems with Documentation for challenge evaluation

Hi,

I was trying to run challenge evaluation looking at the documentation and found problems with documentation.

Could you please update the documentation as to how to get started. Example is:
python3 srunner/challenge/challenge_evaluator.py --list

This throws file not found error and same errors for remaining commands as well.

Thanks.

Deepak

P.S: I could learn a lot from Carla and my sincerest thanks to the whole Carla Team.

AttributeError: type object 'ParallelPolicy' has no attribute 'SUCCESS_ON_ONE'

When I run scenario runner on ubuntu 16.04 with python3 I get this or similar error with all scenarios:
Traceback (most recent call last):
File "scenario_runner.py", line 160, in
main(ARGUMENTS)
File "scenario_runner.py", line 97, in main
scenario = scenario_class(world, args.debug)
File "/usr/local/scenario_runner/Scenarios/object_crash_vehicle.py", line 152, in init
debug_mode=debug_mode)
File "/usr/local/scenario_runner/Scenarios/basic_scenario.py", line 79, in init
behavior = self._create_behavior()
File "/usr/local/scenario_runner/Scenarios/object_crash_vehicle.py", line 191, in _create_behavior
policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE)
AttributeError: type object 'ParallelPolicy' has no attribute 'SUCCESS_ON_ONE'

Updates required for CARLA 0.9.6

CARLA 0.9.6 introduces some API changes

  • No benchmark, fps and level. All need to be set through the PythonAPI
  • wait_for_tick() should be replaced with tick()

ByValue SimulationTime conditions with the given specification is not yet supported

I have written a scenario where the Ego vehicle should start driving when I start the simulation.

➜  scenario_runner git:(3b72dc3) ✗ python scenario_runner.py --openscenario srunner/configs/avenue/EgoStraight.xosc --reloadWorld
Preparing scenario: EgoStraight
The scenario cannot be loaded
ByValue SimulationTime conditions with the given specification is not yet supported

The start condition looks like this:

<Start>
    <ConditionGroup>
        <Condition name="StartCondition" delay="0" edge="rising">
            <ByValue>
                <SimulationTime value="0" rule="equal_to"/>
            </ByValue>
        </Condition>
    </ConditionGroup>
</Start>

Can you tell me a different start condition so that the ego vehicle starts from the beginning? The reason for that is that I can regulate the velocity of the vehicle. I don't know how to change the velocity in the manual_control.py.

Error while Running all scenarios of one scenario class

Hi,

I'm facing problem when running all scenarios

python scenario_runner.py --scenario group:FollowLeadingVehicle

I get the following error

deepak@advcs-Precision-Tower-5810:~/CARLA/scenario_runner$ python scenario_runner.py --scenario group:FollowLeadingVehicle
Preparing scenario: FollowLeadingVehicle_1
ScenarioManager: Running scenario FollowVehicle
Dist int success: Actor(id=5357, type=vehicle.nissan.patrol)
Resetting ego-vehicle!
stopped: Actor(id=5357, type=vehicle.nissan.patrol)
Success!
Resetting ego-vehicle!
Trying to remove a non-existing actor id 5357
Preparing scenario: FollowLeadingVehicleWithObstacle_1
The scenario cannot be loaded
trying to access an expired episode; a new episode was started in the simulation but an object tried accessing the old one.
Preparing scenario: FollowLeadingVehicle_2
The scenario cannot be loaded
trying to access an expired episode; a new episode was started in the simulation but an object tried accessing the old one.
Preparing scenario: FollowLeadingVehicleWithObstacle_2
The scenario cannot be loaded
trying to access an expired episode; a new episode was started in the simulation but an object tried accessing the old one.
Preparing scenario: FollowLeadingVehicle_3
The scenario cannot be loaded
trying to access an expired episode; a new episode was started in the simulation but an object tried accessing the old one.
Preparing scenario: FollowLeadingVehicleWithObstacle_3
The scenario cannot be loaded
trying to access an expired episode; a new episode was started in the simulation but an object tried accessing the old one.
Preparing scenario: FollowLeadingVehicle_4
The scenario cannot be loaded
trying to access an expired episode; a new episode was started in the simulation but an object tried accessing the old one.
Preparing scenario: FollowLeadingVehicleWithObstacle_4
The scenario cannot be loaded
trying to access an expired episode; a new episode was started in the simulation but an object tried accessing the old one.
Preparing scenario: FollowLeadingVehicle_5
The scenario cannot be loaded
trying to access an expired episode; a new episode was started in the simulation but an object tried accessing the old one.

I'm not sure as to what might be the problem
I could locate to the location of the problem in scenario_runner.py file

self.prepare_ego_vehicle(config)

This line was causing issue.

Did anyone have similar problem. How to solve this? Thanks

Spawning problem for TS 02 in town 02.

On running this line:
spawn_location, _ = get_location_in_distance(ego_vehicle, 20).
We get different locations at different times in Town 02.

For example:

  1. Starting location:
    <ego_vehicle x="27" y="110" z="0.4" yaw="180" model="vehicle.lincoln.mkz2017" />
    Result:
    Sometimes we get: (-7.768947124481201, 118.66976165771484, 1.0)
    Sometimes we get: (48.00009536743164, 109.64213562011719, 1.0)

  2. Starting location:
    <ego_vehicle x="28.7" y="302.5" z="0.4" yaw="180" model="vehicle.lincoln.mkz2017" />
    Sometimes we get: (7.699801445007324, 302.9414978027344, 1.0)
    Sometimes we get: (-7.768947124481201, 118.66976165771484, 1.0)

Function:
def get_location_in_distance(actor, distance):
"""
Obtain a location in a given distance from the current actor's location.
Note: Search is stopped on first intersection.

@return obtained location and the traveled distance
"""
waypoint = actor.get_world().get_map().get_waypoint(actor.get_location())
traveled_distance = 0
while not waypoint.is_intersection and traveled_distance < distance:
    waypoint_new = waypoint.next(1.0)[-1]
    traveled_distance += waypoint_new.transform.location.distance(waypoint.transform.location)
    waypoint = waypoint_new

return waypoint.transform.location, traveled_distance

ImportErro when run python scenario_runner.py

Hi, I want to use scenario_runner on carla.
I first export PYTHONPATH=$PYTHONPATH:$~/carla/PythonAPI/dist/carla-0.9.3.egg
Then python scenario_runner.py --scenario FollowLeadingVehicle
I always encounter the error:
import carla
ImportError: No module named carla

I would really appreciate if anyone can help me with it, thanks in advance!

ERROR: 'Vehicle' object has no attribute 'get_control'

(carla) cienet@cienet-desktop:~/scenario_runner$ python scenario_runner.py --scenario FollowLeadingVehicle
Preparing scenario: FollowLeadingVehicle
ScenarioManager: Running scenario FollowVehiclcd

And then I start a new terminal, try to run the manual_control.py

but I met an error like this:


ERROR: 'Vehicle' object has no attribute 'get_control'
Traceback (most recent call last):
  File "manual_control.py", line 681, in main
    game_loop(args)
  File "manual_control.py", line 622, in game_loop
    if not world.tick(clock):
  File "manual_control.py", line 162, in tick
    self.hud.tick(self, clock)
  File "manual_control.py", line 281, in tick
    c = world.vehicle.get_control()
AttributeError: 'Vehicle' object has no attribute 'get_control'

my friend and I have the same version of packages, but it works well at his computer.

Please help to have a look.

Carla [0.9.2] getting slower after each repetition of scenario_runner

In scenario_runner --version 0.1. I found that the FPS of Carla Server drops after every repetition. I think the problem being that actors are not properly destroyed from the server. After the end of scenario I get this output:

LIFETIME: WARNING! the following objects were not destructed. 
LIFETIME: Actor 168 (sensor.other.collision) still alive. 
LIFETIME: tcp client 94 still alive. 
LIFETIME: Actor 163 (vehicle.tesla.model3) still alive. 
LIFETIME: tcp client 89 still alive. 
LIFETIME: tcp client 88 still alive. 
LIFETIME: Actor 159 (sensor.other.collision) still alive. 
LIFETIME: Actor 155 (vehicle.tesla.model3) still alive. 
LIFETIME: Actor 152 (sensor.other.collision) still alive. 
LIFETIME: tcp client 82 still alive. 
LIFETIME: Actor 151 (sensor.other.collision) still alive. 
LIFETIME: Actor 148 (vehicle.nissan.micra) still alive. 
LIFETIME: Actor 147 (vehicle.tesla.model3) still alive. 
LIFETIME: tcp client 77 still alive. 
LIFETIME: Actor 144 (sensor.other.collision) still alive. 
LIFETIME: tcp client 76 still alive. 
LIFETIME: Actor 143 (sensor.other.collision) still alive. 
LIFETIME: Actor 167 (sensor.other.collision) still alive. 
LIFETIME: Actor 139 (vehicle.tesla.model3) still alive. 
LIFETIME: tcp client 28 still alive. 
LIFETIME: Actor 164 (vehicle.nissan.micra) still alive. 
LIFETIME: Actor 120 (sensor.other.collision) still alive. 
LIFETIME: Actor 55 (sensor.other.collision) still alive. 
LIFETIME: Actor 156 (vehicle.nissan.micra) still alive. 
LIFETIME: Actor 136 (sensor.other.collision) still alive. 
LIFETIME: tcp client 23 still alive.

I am doing actor.destroy() and actor = None after each repetition and they are being destroyed (I cannot see them in the server) but the memory still not being released and I get above output.

Could someone help me how to destroy the actors properly??

Can't run Scenario_runner

OS: Ubuntu 16.04
Python: 3.5
I'm trying to run the : python scenario_runner.py
The problem is showed below. I use Carla 0.8.4 and newest py_trees packgae.
image

import agent error

ModuleNotFoundError: No module named 'agents'
and I already try
export PYTHONPATH=$PYTHONPATH:/Documents/carla94/PythonAPI/carla-0.9.4-py3.5-linux-x86_64.egg:/Documents/PythonAPI
please help, thanks

error in scenario loading

Hi, @nsubiron

I have tried run the scenario_runner.py script, the command is:
python scenario_runner.py --scenario FollowLeadingVehicle.
The output is
Configuration for scenario FollowLeadingVehicle cannot be found!

After I jumped into your code, I found that the function named "find_scenario_config" in file "./srunner/tools/config_parser.py" may have errors. It parses the xml file to some attributes and compares them with the input scenario's name. But the attributes are named like "FollowLeadingVehicle_5", "FollowLeadingVehicle_6", etc.. There is no such an attribute named "FollowLeadingVehicle".

Did I miss some arguments to specify the scenario?

Track4 CARLA challeng

I tried to run Track4SampleAgent but when the pygame windows appears, the program is frozen. It seems that the run step function of the agent is never called. I used this command to run the agent:

python3 ${ROOT_SCENARIO_RUNNER}/srunner/challenge/challenge_evaluator_routes.py \
--scenarios=${ROOT_SCENARIO_RUNNER}/srunner/challenge/all_towns_traffic_scenarios3_4.json \
--routes=${ROOT_SCENARIO_RUNNER}/srunner/challenge/routes_training.xml \
--debug=0 \
--agent=${ROOT_SCENARIO_RUNNER}/srunner/challenge/autoagents/Track4SampleAgent.py

Has anyone successfully run the Track4SampleAgent ?
Thanks in advance for any help :D

Debug flag affects agent input and behavior

Specifying the debug flag changes not just the visualization, but also the camera input from the agent; see attached screen capture. This substantially changes the behavior of agents that depend on RGB input.

screenshot

This should at the least be documented, but ideally there would be a way to fix this as it makes the debugging flags much less useful.

In branch carla_challenge, I executed the imitation learning baseline test three times with and without the debug flag:
CHALLENGE_PHASE_CODENAME=dev_track_2 python3 ${ROOT_SCENARIO_RUNNER}/srunner/challenge/challenge_evaluator_routes.py --scenarios=${ROOT_SCENARIO_RUNNER}/srunner/challenge/all_towns_traffic_scenarios1_3_4.json --routes=${ROOT_SCENARIO_RUNNER}/srunner/challenge/routes_debug.xml --agent=../coiltraine/drive/CoILBaseline.py --config=../coiltraine/drive/sample_agent.json --debug=0 --filename=debug0-rep2.json

With debug=0, I got average route points / infraction points of 12.73 / 17.5 (rep 0), 12.82 / 15.0 (rep 1) and 6.23 / 15.0 (rep 2). With debug=1, I got 4.02 / 17.5 (rep 0), 15.95 / 30.0 (rep 1) and 14.79 / 25.0 (rep 2).

Raw results below.

debug0-rep0.log
debug0-rep1.log
debug0-rep2.log
debug1-rep0.log
debug1-rep1.log
debug1-rep2.log

Missing path in Getting Started documentation

It appears that with the release of Carla 0.9.3 in the Getting Started documentation the following needs to be added to PYTHONPATH:

${CARLA_ROOT}/PythonAPI/agents/navigation

Also, it would be good to explicitly add to the instructions the step to pip install networkx .

Not expected result when running challenge_evaluation

Hi,
I started the Carla server both with no editor. Later, I also tried with the unreal editor.
Then, I tried running as per the documentation,
python srunner/challenge/challenge_evaluator_routes.py --scenarios=${ROOT_SCENARIO_RUNNER}/srunner/challenge/all_towns_traffic_scenarios1_3_4.json --agent=${ROOT_SCENARIO_RUNNER}/srunner/challenge/autoagents/DummyAgent.py

and saw no output from sensors in the terminal.
I checked the results.json file and below is the image of sample part of file.
I understood that the error is due to Carla simulator not responding. But then it responds when I run normal scenario_runner.py scenario to verify the problem.

challenge_ev_error

I'm not sure what might be the problem. Is it possible to try with a new file with a small number of scenarios?

I tried with HumanAgent and a blank pygame window pops up and vanishes and same thing repeats.

Thanks,
Deepak

Throttle value does not drop down to zero after exceeding the target velocity in KeepVelocity Class

Dear All,

I just noticed after using KeepVelocity class for controlling both the Ego and the Othercar, that the throttle value does not drop down to zero after exceeding the set target_velocity.

Can any one inform me how to ensure that the throttle value drop down to zero?

I attached my edited code. I disable the scenario seq because I am not interested in the seq right now. I just want to be sure that the throttle value drop to zero.

Thanks.

no_signal_junction_crossing.py.zip

loading new episodes repeatedly

I am running the latest Carla(0.9.5) precompiled package, and following the steps as described in Carla challenge to run scenerio_runner - https://carlachallenge.org/get-started/

I am able to run Carla server, but when I try to run
python ${ROOT_SCENARIO_RUNNER}/srunner/challenge/challenge_evaluator_
routes.py --scenarios=${ROOT_SCENARIO_RUNNER}/srunner/challenge/all_towns_traffic_scenarios1_3_4.json --routes=${ROOT_SCENARIO_RUNNER}/srunner/challenge/routes_training.xml --debug=1 --agent=HumanAgent.py

I get this error-

[2019.05.05-18.35.35:496][867]LogLoad: Took 51.870737 seconds to LoadMap(/Game/Carla/Maps/Town01)
[2019.05.05-18.35.36:436][870]LogCarla: Warning: Loading a new episode: /Game/Carla/Maps/Town01
[2019.05.05-18.35.36:436][871]LogNet: Browse: /Game/Carla/Maps/Town01
[2019.05.05-18.35.36:449][871]LogLoad: LoadMap: /Game/Carla/Maps/Town01
[2019.05.05-18.35.36:739][871]LogStreaming: Display: Flushing async loaders.
[2019.05.05-18.36.17:000][871]LogAIModule: Creating AISystem for world Town01
[2019.05.05-18.36.27:985][871]LogLoad: Game class is 'TheNewCarlaGameMode_C'
[2019.05.05-18.36.28:216][871]LogWorld: Bringing World /Game/Carla/Maps/Town01.Town01 up for play (max tick rate 0) at 2019.05.05-20.36.28
[2019.05.05-18.36.28:282][871]LogWorld: Bringing up level for play took: 0.227486
[2019.05.05-18.36.28:342][871]LogCarlaServer: New episode 'Town01' started
[2019.05.05-18.36.28:352][871]LogLoad: Took 51.902780 seconds to LoadMap(/Game/Carla/Maps/Town01)
[2019.05.05-18.36.29:410][873]LogCarla: Warning: Loading a new episode: /Game/Carla/Maps/Town01
[2019.05.05-18.36.29:410][874]LogNet: Browse: /Game/Carla/Maps/Town01
[2019.05.05-18.36.29:426][874]LogLoad: LoadMap: /Game/Carla/Maps/Town01
[2019.05.05-18.36.29:710][874]LogStreaming: Display: Flushing async loaders.
^C^CFUnixPlatformMisc::RequestExitWithStatus

Scenario Runner : While using WaypointFollower vehicle is comming back to the original location

Hi,

I am trying to create a new scenario, kindly refer the attached file :
lane_cut_in.txt
config_file :

<?xml version="1.0"?>
<scenarios>
    <scenario name="LaneCutIn_1" type="LaneCutIn" town="Town04">
        <ego_vehicle x="248.547" y="-392.23" z="1.2" yaw="180" model="vehicle.nissan.patrol" />
    </scenario>
</scenarios>

Code Snippet :

#!/usr/bin/env python

"""
Lane Cut In:

Another vehicle overtakes the ego vehicle and cuts-in in front of it.

"""

import random

import py_trees

import carla

from srunner.scenariomanager.atomic_scenario_behavior import *
from srunner.scenariomanager.custom_atomic_scenario_behavior import AtTriggerDistanceToVehicle, LaneChange
from srunner.scenariomanager.atomic_scenario_criteria import *
from srunner.scenariomanager.timer import TimeOut
from srunner.scenarios.basic_scenario import *
from srunner.tools.scenario_helper import *

from agents.navigation.local_planner import RoadOption

LANE_CUT_IN = [
    "LaneCutIn"
]


class LaneCutIn(BasicScenario):

    """
    This class holds everything required for a "Lane Cut In" scenario 
    """
    category = "LaneCutIn"

    timeout = 1000            # Timeout of scenario in seconds

    def __init__(self, world, ego_vehicle, config, randomize=False, debug_mode=False, criteria_enable=True,
                 timeout=1000):
        """
        Setup all relevant parameters and create scenario

        If randomize is True, the scenario parameters are randomized
        """

        self._map = CarlaDataProvider.get_map()
        self._ev_tv1_distance = 1000
        self._first_vehicle_location = 25
        self._ego_vehicle_speed = 15
        self._first_vehicle_speed = 25
        self._reference_waypoint = self._map.get_waypoint(config.trigger_point.location)
        self._other_actor_max_brake = 1.0
        self._other_actor_stop_in_front_intersection = 20
        self._other_actor_transform = None
        # Timeout of scenario in seconds
        self.timeout = timeout

        super(LaneCutIn, self).__init__("LaneCutIn",
                                                   ego_vehicle,
                                                   config,
                                                   world,
                                                   debug_mode,
                                                   criteria_enable=criteria_enable)

        if randomize:
            self._ego_other_distance_start = random.randint(4, 8)

            # Example code how to randomize start location
            # distance = random.randint(20, 80)
            # new_location, _ = get_location_in_distance(self.ego_vehicle, distance)
            # waypoint = CarlaDataProvider.get_map().get_waypoint(new_location)
            # waypoint.transform.location.z += 39
            # self.other_actors[0].set_transform(waypoint.transform)

    def _initialize_actors(self, config):
        """
        Custom initialization
        """

        _ego_vehicle_current_waypoint = self._map.get_waypoint(self._reference_waypoint.transform.location) 
        
        # calculate EV's new waypoints. 
        #_ego_vehicle_new_waypoint, _ego_vehicle_dist = get_waypoint_in_distance(_ego_vehicle_current_waypoint, self._ev_tv1_distance)
        
        # calculate TV1's new waypoints
        _first_vehicle_waypoint = _ego_vehicle_current_waypoint.get_left_lane()   

        # set new position to EV        
        #self.ego_vehicle.set_transform(_ego_vehicle_new_waypoint.transform)
               
        first_vehicle_transform = carla.Transform(_first_vehicle_waypoint.transform.location, _first_vehicle_waypoint.transform.rotation)
 
        self._other_actor_transform = first_vehicle_transform

        first_vehicle = CarlaActorPool.request_new_actor('vehicle.nissan.patrol', first_vehicle_transform) 

        self.other_actors.append(first_vehicle)

    def _calculate_waypoint(self, source, destination):
        """
        Return list of way points between source and destination.
		Start point and end point of lane change are considered.
		Slope of the line forming from those points is considered.
		waypoints are calculated on that line in this function using slope formula(slope = (Y2 - Y1)/ (X2 - X1)) 
        """
        _slope = (float(destination.transform.location.y) - float(source.transform.location.y)) / (float(destination.transform.location.x) - float(source.transform.location.x))
        _route = list()
        _resolution = (float(destination.transform.location.y) - float(source.transform.location.y))  / 50
        y = float(source.transform.location.y)
        _copyt_waypoint_cls = destination
        try:
            for _cnt in range(50):
                y = float(y + _resolution)
                x =  ((float(y) - float(source.transform.location.y)) / _slope ) + float(source.transform.location.x)                
                _copyt_waypoint_cls.transform.location.x = x
                _copyt_waypoint_cls.transform.location.y = y
                _copyt_waypoint_cls.transform.location.z = 0
                _copyt_waypoint_cls.transform.rotation.yaw = 0
                _copyt_waypoint_cls.transform.rotation.pitch = 0
                _copyt_waypoint_cls.transform.rotation.roll = 0
                _route.append((_copyt_waypoint_cls, RoadOption.VOID))
        except Exception as e:
            print("Error while _calculate_waypoint() : ",e)

        return _route

    def _get_destination_waypoint(self, _vehicle_current_waypoint, lane_side=None, distance=40):
        """
        """                 
        _vehicle_new_waypoint, _vehicle_dist = get_waypoint_in_distance(_vehicle_current_waypoint, distance)        

        if lane_side == 'right':
            _destiantion_waypoint = _vehicle_new_waypoint.get_right_lane() 
        elif lane_side == 'left':
            _destiantion_waypoint = _vehicle_new_waypoint.get_left_lane() 
        else: 
            print("----------------- ERROR while generating waypoint for destination vehicle")

        return _destiantion_waypoint         

    def _create_behavior(self):
        """
		The ego vehicle will work to restore a safe following distance. A combination of speed reduction and anticipating future motion of the cut-in vehicle
        should lead to the safe following distance being restored within 5 seconds of the initial maneuver of the cut-in vehicle.        
        """      
        print("other actor previous :", self.other_actors[0].get_location())        
        # STAGE 1
        stage_1 = py_trees.composites.Parallel("stage_1", policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE)        
        stage_1.add_child(WaypointFollower(self.ego_vehicle, self._ego_vehicle_speed))
        stage_1.add_child(DriveDistance(self.ego_vehicle, 15))
        
        # STAGE 2             
        stage_2 = py_trees.composites.Parallel("stage_2", policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE)                
        stage_2.add_child(WaypointFollower(self.ego_vehicle, self._ego_vehicle_speed))
        stage_2.add_child(WaypointFollower(self.other_actors[0], self._first_vehicle_speed))
        # TODO: Replace DriveDistance with AtTriggerDistance. 
        #stage_2.add_child(AtTriggerDistanceToVehicle(self.other_actors[0], 5, self.ego_vehicle, 5, 20))
        stage_2.add_child(DriveDistance(self.other_actors[0], 100))

        # get vehicle current waypoints.
        _vehicle_current_waypoint = CarlaDataProvider.get_map().get_waypoint(self.other_actors[0].get_location())

        # get destination waypoints.
        _destiantion_waypoint = self._get_destination_waypoint(_vehicle_current_waypoint, lane_side='left')

        # calculate waypoint from source to destination
        _route = self._calculate_waypoint(_vehicle_current_waypoint, _destiantion_waypoint)

        # STAGE 3
        stage_3 = py_trees.composites.Parallel("stage_3", policy=py_trees.common.ParallelPolicy.SUCCESS_ON_ONE)
        stage_3.add_child(WaypointFollower(self.other_actors[0], self._first_vehicle_speed, plan=_route))
        stage_3.add_child(WaypointFollower(self.ego_vehicle, self._ego_vehicle_speed))
        stage_3.add_child(DriveDistance(self.ego_vehicle, 1000))

        # Build behavior tree
        sequence = py_trees.composites.Sequence("Sequence Behavior")
        sequence.add_child(stage_1)
        sequence.add_child(stage_2)  
        sequence.add_child(stage_3)

        return sequence  

    def _create_test_criteria(self):
        """
        A list of all test criteria will be created that is later used
        in parallel behavior tree.
        """
        criteria = []

        collision_criterion = CollisionTest(self.ego_vehicle)

        criteria.append(collision_criterion)

        return criteria

    def __del__(self):
        """
        Remove all actors upon deletion
        """
        self.remove_all_actors()

stage_1:
Ego vehicle is driving in it's speed using WaypointFollower till 15 m (DriveDistance as end condition)

stage_2:

  1. Traffic vehicle and ego vehicle both are driving in their respective speed using WaypointFollower
  2. end condition = Traffic vehicle drives 150m

stage_3:

  1. Lane change of Traffic Vehicle :
    i. Ego vehicle will drive in it's speed using Waypoint Follower
    ii. Traffic vehicle will follow the generated route (route is generated using : _calculate_waypoint()) using WaypointFollower
    iii. end condition = Ego Vehicle drives 1000m

I have added this stages in a sequence tree and tried to run it.

My Observations :

  1. Till stage_2 it works well.
  2. When stage_3 start running, ego vehicle takes U-Turn and goes back to it's previous location and then again take U-Turn and then drive straight
  3. We tried to give the generated route to traffic vehicle and ego vehicle in the stage_1, then it is working.

Kindly help me to know why this is happening.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.