Comments (7)
This a code example for collision sensor, could you check if this is working for you? The attachment type is not necesary for sensors. After that could you check the logs? If you are not using a package they should be located in "CARLA_ROOT/Unreal/CarlaUE4/Saved/Logs"
from __future__ import print_function
import argparse
import glob
import math
import os
import sys
import time
try:
sys.path.append(glob.glob('../carla/dist/carla-*%d.%d-%s.egg' % (
sys.version_info.major,
sys.version_info.minor,
'win-amd64' if os.name == 'nt' else 'linux-x86_64'))[0])
except IndexError:
pass
try:
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + '/carla')
except IndexError:
pass
import carla
def _on_collision(event):
print(f"Collision with {event.other_actor.type_id}")
def main():
client = carla.Client()
world = client.get_world()
bp_lib = world.get_blueprint_library()
spectator = world.get_spectator()
# Spawn the actor
bp = bp_lib.filter("*walker*")[0]
# bp.set_attribute('is_invincible', 'false')
walker = world.spawn_actor(bp, carla.Transform(carla.Location(200.7, 199.3, 0.2), carla.Rotation()))
bp = bp_lib.filter("*mkz_2020*")[0]
vehicle = world.spawn_actor(bp, carla.Transform(carla.Location(177.7, 198.8, 0.2), carla.Rotation()))
spectator.set_transform(carla.Transform(carla.Location(205.9, 193.2, 3.9), carla.Rotation(pitch=-29, yaw=135)))
collision_bp = bp_lib.find('sensor.other.collision')
sensor_collision = world.spawn_actor(collision_bp, carla.Transform(), attach_to=vehicle)
sensor_collision.listen(lambda event: _on_collision(event))
vehicle.apply_control(carla.VehicleControl(throttle=1))
for _ in range(400):
world.tick()
walker.destroy()
sensor_collision.destroy()
vehicle.destroy()
if __name__ == '__main__':
main()
from carla.
We have updated dev branch, could you update your code and then try this again to know if that is working now?
from carla.
Hello again, any updates? otherwise I will close this issue
from carla.
Okay. Thanks. Let me check this.
from carla.
Any updates?
from carla.
Hi, currently I switched to imitation learning in CARLA. So I may not need it now. But really grateful for your support. Do you have any work experience for imitation learning in CARLA?
from carla.
No but maybe someone does. Open a discussion or search for it in the discussions. I will be closing this issue for now.
from carla.
Related Issues (20)
- Controlling Pedestrians with Motion Capture Devices in Carla HOT 2
- Fake Interior Building Shader
- Change Default Parameters in UActorBlueprintFunctionLibrary::MakeCameraDefinition HOT 1
- Create C++ Base Class for BP_Sky HOT 1
- Change SetCameraDefaultOverrides to apply PostProcessVolume settings HOT 1
- Carla server crashed.Signal 11 caught. Malloc Size=65538 LargeMemoryPoolOffset=65554
- The output point cloud is referenced to what coordinate system, relative to the vehicle itself or the LiDAR? HOT 1
- How to change the terrain? HOT 1
- Carla UnrealEngine changed files paths after using a newer Carla version HOT 5
- Does Carla Plugin in CarlaUnreal Project on ue5-dev branch is complete ? HOT 1
- Agent unresponsive for first 50 ticks in PythonAPI/examples/automatic_control.py HOT 2
- manual_control_steeringwheel.py : cannot accelerate ego vehicle after standstill (G920)
- make launch osm2odr.lib
- How to publish the Carla project compiled from source code into an executable file HOT 1
- error when running make osmrenderer in ubuntu2 2.04
- Memory usage increasing indefinitely while CarlaUE4 is minimized HOT 10
- what(): Responding error from function set_actor_simulate_physics: Actor could not be found in the registry. Actor Id: 2377 HOT 2
- Modify Building tool to use UDIMS textures
- Getting an override warning when using Makefile
- Shortest Route between point_a and point_b HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from carla.