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

Speed values do not work as expected inside CARLA #38

Open
Dactylif opened this issue Dec 24, 2021 · 0 comments
Open

Speed values do not work as expected inside CARLA #38

Dactylif opened this issue Dec 24, 2021 · 0 comments

Comments

@Dactylif
Copy link

Issue

CARLA ignores speed values over 10 and speed values are interpreted as mp/h.
For example the value of 10 ends up at 16-17 km/h when checked inside CARLA, but a value of 20 also gets converted to ~16-17 km/h. Lower values affect the vehicle as expected, but are still interpreted as mp/h.
Neither do FollowLaneBehavior(EGO_SPEED) or do FollowLaneBehavior(20) from the example script work as expected.

Env

OS: Ubuntu 21.04
Carla: 0.9.12
Python 3.7
scenic: 2.1.0b1

Steps to reproduce

  • Start CarlaUE4 instance
  • Execute scenic example.scenic --simulate

Example script

The example script I used which is a slightly modified version from this one: https://carla.readthedocs.io/en/latest/tuto_G_scenic/

param map = localPath('../../../tests/formats/opendrive/maps/CARLA/Town01.xodr')
param carla_map = 'Town01'
model scenic.simulators.carla.model

## CONSTANTS
EGO_MODEL = "vehicle.lincoln.mkz_2017"
EGO_SPEED = 15
EGO_BRAKING_THRESHOLD = 12

LEADCAR_BRAKING_THRESHOLD = 10

BRAKE_ACTION = 1.0

## DEFINING BEHAVIORS
# EGO BEHAVIOR: Follow lane, and brake after passing a threshold distance to the leading car
behavior EgoBehavior():
    try:
        do FollowLaneBehavior(EGO_SPEED)

    interrupt when withinDistanceToAnyCars(self, EGO_BRAKING_THRESHOLD):
        take SetBrakeAction(BRAKE_ACTION)

# LEAD CAR BEHAVIOR: Follow lane, and brake after passing a threshold distance to obstacle
behavior LeadingCarBehavior():
    try: 
        do FollowLaneBehavior(20)

    interrupt when withinDistanceToAnyObjs(self, LEADCAR_BRAKING_THRESHOLD):
        take SetBrakeAction(BRAKE_ACTION)
        
## DEFINING SPATIAL RELATIONS
# make sure to put '*' to uniformly randomly select from all elements of the list, 'lanes'
lane = Uniform(*network.lanes)

obstacle = Trash on lane.centerline

leadCar = Car following roadDirection from obstacle for Range(-50, -30),
        with blueprint EGO_MODEL,
        with behavior LeadingCarBehavior()
        
        
ego = Car following roadDirection from leadCar for Range(-15, -10),
        with blueprint EGO_MODEL,
        with behavior EgoBehavior()
        
require (distance to intersection) > 80
terminate when ego.speed < 0.1 and (distance to obstacle) < 30
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

No branches or pull requests

1 participant