본문으로 건너뛰기
Skillpedia
기타15k · #11089

control-vehicle

하는 일

스킬은 CARLA 시뮬레이션에서 차량 한 대를 직접 제어합니다. 차를 직접 몰거나 특정 제어 명령을 시험하려는 사람을 위한 스킬입니다.

사용하는 경우

  • ✓특정 차량을 직접 조향하거나 가속하거나 제동하고 싶을 때.
  • ✓속도 목표를 설정하거나 차 문을 열고 닫고 싶을 때.
  • ✓차량의 수동 운전을 멈춰야 할 때.

스킬 링크

https://github.com/carla-simulator/carla/blob/ue58-dev/Skills/python-api/control-vehicle/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/carla-simulator/carla/blob/ue58-dev/Skills/python-api/control-vehicle/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“자차를 절반 스로틀로 3초 동안 앞으로 몰고, 그다음 제동해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 선택한 차량에 제어 입력을 보냅니다. 먼저 그 차량의 자동 주행을 끕니다. 명령은 정해진 시간 동안 유지할 수 있고, 정지 명령은 수동 운전을 끝냅니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Control a vehicle directly

Paths. scripts/… and references/… 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

자주 묻는 질문

자동 주행을 끄나요?

네. 수동 제어는 먼저 그 차량의 자동 주행을 끕니다.

기본으로 어떤 차를 제어하나요?

역할 이름(role name)이 hero인 차량인 자차입니다.

ROS로 차를 제어할 수 있나요?

네. 스킬은 hero 차량의 ROS 2 명령 토픽을 알려 주므로, ROS에서 명령을 보낼 수 있습니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
15k
순위
#11089
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬