control-vehicle
Skill này làm gì
Skill trực tiếp điều khiển một xe trong mô phỏng CARLA. Skill dành cho người muốn tự lái xe hoặc kiểm thử một lệnh điều khiển cụ thể.
Khi nào nên dùng
- ✓Khi bạn muốn lái, tăng tốc hoặc phanh một xe cụ thể bằng tay.
- ✓Khi bạn muốn đặt mục tiêu tốc độ hoặc mở hoặc đóng cửa xe.
- ✓Khi bạn cần dừng việc lái thủ công của một xe.
Liên kết skill
https://github.com/carla-simulator/carla/blob/ue58-dev/Skills/python-api/control-vehicle/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Hãy lái xe ego tiến về phía trước với nửa ga trong ba giây, rồi phanh.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent gửi tín hiệu điều khiển đến xe đã chọn, và trước tiên tắt tự lái cho xe đó. Agent có thể giữ một lệnh trong một khoảng thời gian, và lệnh dừng sẽ kết thúc việc lái thủ công.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Control a vehicle directly
Paths.
scripts/…andreferences/…below are relative to the directory holding this SKILL.md. Your working directory is the user's project, not that directory, so prefix them with its absolute path or the command is not found.
Drive one vehicle yourself: control input, Ackermann speed target, lights, doors,
physics. It targets the ego (role_name = hero) by default, or any vehicle by
--id / --role / --filter. This is manual control — control and
ackermann turn autopilot off first; for autonomous traffic use the
control-traffic skill instead.
Instructions
Progress:
- [ ] Step 1: Check prerequisites (bash scripts/check_env.sh), clear FAILs
- [ ] Step 2: Ensure a target vehicle exists (spawn-vehicles ego)
- [ ] Step 3: Apply the command (control / ackermann / lights / door / physics)
- [ ] Step 4: Confirm on a rendered server; `stop` to halt manual driving
Commands need CARLA_HOST/CARLA_PORT/TM_PORT from scripts/env.sh.
Step 1: Check prerequisites
bash scripts/check_env.sh
Step 3: Control
source scripts/env.sh
# drive the ego forward for 3 s, then it brakes
python3 scripts/vehicle_control.py control --throttle 0.5 --hold 3
# turn while creeping forward
python3 scripts/vehicle_control.py control --throttle 0.3 --steer -0.4 --hold 2
# hold a target speed (built-in controller does throttle/brake for you)
python3 scripts/vehicle_control.py ackermann --speed 8
# lights: headlights + brake on; position off
python3 scripts/vehicle_control.py lights --on LowBeam,Brake --off Position
# left blinker on a specific car
python3 scripts/vehicle_control.py lights --filter '*prius*' --on LeftBlinker
# doors
python3 scripts/vehicle_control.py door --open FL,FR
python3 scripts/vehicle_control.py door --close All
# physics: read, then make it heavier / draggier
python3 scripts/vehicle_control.py physics --show
python3 scripts/vehicle_control.py physics --mass 2200 --drag 0.4
# emergency stop
python3 scripts/vehicle_control.py stop
# what ROS 2 topics drive this vehicle (read-only)
python3 scripts/vehicle_control.py ros-info
Driving it from ROS 2
On a server started with --ros2 ([[run-carla-server]] ROS2=1), the hero
vehicle exposes two command topics — the server subscribes, so the commands come
from outside this skill:
| Topic (DDS name) | Message | Maps to |
|---|---|---|
rt/carla/<ros_name>/vehicle_control_cmd |
carla_msgs/CarlaEgoVehicleControl |
carla.VehicleControl (throttle, steer, brake, hand_brake, reverse, gear, manual_gear_shift) |
rt/carla/<ros_name>/ackermann_control_cmd |
ackermann_msgs/AckermannDriveStamped |
carla.VehicleAckermannControl (steering_angle, speed, acceleration, jerk) |
ros-info prints them for the resolved vehicle plus a ready-to-run
ros2 topic pub line, and says so plainly when the target cannot be driven
from ROS: only role_name = hero gets subscribers (the server tests that string
in ActorDispatcher), so ordinary traffic never does. Spawn the hero with
[[spawn-vehicles]] ego --ros-name <name>.
You need the message definitions to publish. Verified: neither type ships with
a stock ROS 2 install, so ros2 topic pub carla_msgs/msg/... fails with an unknown
type until you provide them:
| Type | Where it comes from |
|---|---|
ackermann_msgs/AckermannDriveStamped |
sudo apt install ros-$ROS_DISTRO-ackermann-msgs |
carla_msgs/CarlaEgoVehicleControl |
not an apt package — build carla_msgs from carla-ros-bridge, or hand-write a one-message package (below) |
A minimal carla_msgs is enough and takes a minute — this exact recipe was used to
drive the hero from ROS (0 → 64 km/h) on a packaged server:
mkdir -p ws/src/carla_msgs/msg
cat > ws/src/carla_msgs/msg/CarlaEgoVehicleControl.msg <<'EOF'
std_msgs/Header header
float32 throttle
float32 steer
float32 brake
bool hand_brake
bool reverse
int32 gear
bool manual_gear_shift
EOF
# + a standard ament_cmake package.xml / CMakeLists.txt calling
# rosidl_generate_interfaces(${PROJECT_NAME} "msg/CarlaEgoVehicleControl.msg"
# DEPENDENCIES std_msgs)
colcon build --packages-select carla_msgs && source install/setup.bash
ros2 topic pub -r 20 /carla/hero/vehicle_control_cmd \
carla_msgs/msg/CarlaEgoVehicleControl "{throttle: 0.8}"
Field order is the contract, not the field names: CDR is positional
Câu hỏi thường gặp
Skill có tắt tự lái không?
Có. Điều khiển thủ công trước tiên sẽ tắt tự lái cho xe đó.
Mặc định skill điều khiển xe nào?
Xe ego, tức là xe có tên vai trò hero.
Tôi có thể điều khiển xe từ ROS không?
Có. Skill báo cáo các topic lệnh ROS 2 của xe hero, để bạn gửi lệnh từ ROS.
Chi tiết
Mô tả gốc của tác giả
Directly drives a specific vehicle on a running CARLA server — raw VehicleControl (throttle/steer/brake/reverse/hand-brake), Ackermann speed control, vehicle lights, opening/closing doors, and physics-control tuning; ros-info reports the native ROS 2 command topics (vehicle_control_cmd, ackermann_control_cmd) for the hero. Targets the ego by default. Use when the user asks to "drive/steer the car", "accelerate/brake/reverse", "set a target speed", "turn on the headlights/blinkers/brake lights", "open a door", "drive the car from ROS", or "change the vehicle's mass/drag/physics". This is manual
repo: carla-simulator/carla
Độ phổ biến
- Sao GitHub
- 15k
- Vị trí xếp hạng
- #11089
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
create-leaderboard-route
15kGiúp agent của bạn tạo file tuyến đường CARLA Leaderboard bằng cách đặt các điểm waypoint và trigger kịch bản từ camera của simulator, rồi kiểm tra và sắp xếp chúng.
package-leaderboard-agent
15kGiúp agent của bạn đóng gói một agent lái xe thành image Docker để nộp lên CARLA Leaderboard, kiểm tra cấu trúc thư mục và thử rằng image nạp được agent.
read-leaderboard-results
15kGiúp agent của bạn đọc file kết quả CARLA Leaderboard, giải thích điểm và vi phạm của từng tuyến, và chấm lại một lần chạy theo phiên bản luật khác.
run-leaderboard-evaluation
15kGiúp agent của bạn chạy bộ đánh giá CARLA Leaderboard trên một tập tuyến với agent lái xe, kiểm tra thiết lập trước và lưu checkpoint để có thể tiếp tục.
Skill tương tự
blucli
394kGiúp agent của bạn tìm, phát, tạm dừng, nhóm và chỉnh âm lượng loa Bluesound và NAD qua lệnh blu.
camsnap
394kGiúp agent của bạn chụp ảnh, quay clip ngắn hoặc lấy sự kiện chuyển động từ camera mạng và webcam nội bộ mà bạn đã thiết lập.
eightctl
394kGiúp agent của bạn kiểm tra và điều khiển thiết bị Eight Sleep pod, gồm nhiệt độ, báo thức và lịch ngủ.