当前位置:网站首页>ROS bridge notes (05) - Carla_ ackermann_ Control function package (convert Ackermann messages into carlaegovehiclecontrol messages)
ROS bridge notes (05) - Carla_ ackermann_ Control function package (convert Ackermann messages into carlaegovehiclecontrol messages)
2022-07-07 08:07:00 【wohu1104】
Official website :https://carla.readthedocs.io/projects/ros-bridge/en/latest/carla_ackermann_control/
Reference resources :https://blog.csdn.net/dfman1978/article/details/125077551
carla_ackermann_control
Package usage Ackermann messages control CARLA
vehicle . The package will Ackermann messages Convert to CarlaEgoVehicleControl news .
It is from CARLA
Read vehicle information , And pass this information to a person based on Python
Of PID
controller , be called simple-pid
, To control acceleration and speed .
stay ros_bridge
in , Besides using manual_control
Bao Lai directly uses the keyboard to control the simulation car , You can also use ackermann
( Ackerman ) To control . stay carla
and autoware
In the process of joint simulation ,autoware
The final control information is to be converted into ackermann
Control command , Finally, control the simulation vehicle .
1. Configuration parameters
In the use of ROS 1
and ROS 2
when , Can be in The configuration file Initial setting parameters in , Pass... At run time ROS 1
Dynamically reconfigure parameters dynamic_reconfigure.
2. Test control messages
adopt topic /carla/<ROLE NAME>/ackermann_cmd
Send commands to the trolley to test the settings . for example , Run the following command , Name the role as ego_vehicle
Self vehicle with 10 rice / Move forward at the speed of seconds :
rostopic pub /carla/ego_vehicle/ackermann_cmd ackermann_msgs/AckermannDrive \
"{steering_angle: 0.0, steering_angle_velocity: 0.0, speed: 10, acceleration: 0.0, jerk: 0.0}" -r 10
Or let the vehicle 1.22 The angle of the arc moves forward when turning :
rostopic pub /carla/ego_vehicle/ackermann_cmd ackermann_msgs/AckermannDrive \
"{steering_angle: 1.22, steering_angle_velocity: 0.0, speed: 10, acceleration: 0.0, jerk: 0.0}" -r 10
After the above command is executed , adopt rostopic
Command view , The topic
The vehicle will not move without subscribers .
[email protected]:~/tool$ rostopic info /carla/ego_vehicle/ackermann_cmd
Type: ackermann_msgs/AckermannDrive
Publishers:
* /rostopic_16525_1657090091755 (http://wohu-pc:39319/)
Subscribers: None
[email protected]:~/tool$
among /carla/ego_vehicle/ackermann_cmd
It was sent ackermann
command , The node parses this command , And then convert to ros_bridge
Message formats that nodes can recognize :/carla/ego_vehicle/vehicle_conttrol_cmd
, issue /carla_ros_bridge
node .
Can be in carla-ros-bridge/catkin_ws/src/ros-bridge/carla_ros_bridge/src/carla_ros_bridge/ego_vehicle.py
See in the code
self.control_subscriber = node.new_subscription(
CarlaEgoVehicleControl,
self.get_topic_prefix() + "/vehicle_control_cmd",
lambda data: self.control_command_updated(data, manual_override=False),
qos_profile=10)
self.manual_control_subscriber = node.new_subscription(
CarlaEgoVehicleControl,
self.get_topic_prefix() + "/vehicle_control_cmd_manual",
lambda data: self.control_command_updated(data, manual_override=True),
qos_profile=10)
The real execution function is control_command_updated
, It reads as follows :
def control_command_updated(self, ros_vehicle_control, manual_override):
""" Receive a CarlaEgoVehicleControl msg and send to CARLA This function gets called whenever a ROS CarlaEgoVehicleControl is received. If the mode is valid (either normal or manual), the received ROS message is converted into carla.VehicleControl command and sent to CARLA. This bridge is not responsible for any restrictions on velocity or steering. It's just forwarding the ROS input to CARLA :param manual_override: manually override the vehicle control command :param ros_vehicle_control: current vehicle control input received via ROS :type ros_vehicle_control: carla_msgs.msg.CarlaEgoVehicleControl :return: """
if manual_override == self.vehicle_control_override:
vehicle_control = VehicleControl()
vehicle_control.hand_brake = ros_vehicle_control.hand_brake
vehicle_control.brake = ros_vehicle_control.brake
vehicle_control.steer = ros_vehicle_control.steer
vehicle_control.throttle = ros_vehicle_control.throttle
vehicle_control.reverse = ros_vehicle_control.reverse
vehicle_control.manual_gear_shift = ros_vehicle_control.manual_gear_shift
vehicle_control.gear = ros_vehicle_control.gear
self.carla_actor.apply_control(vehicle_control)
self._vehicle_control_applied_callback(self.get_id())
The notes clearly explain receive CarlaEgoVehicleControl
news , Send to CARLA
.
self.carla_actor.apply_control(vehicle_control)
This function is to control the simulation vehicle .
3. summary
The package will Ackermann messages Convert to CarlaEgoVehicleControl
News , Actually ROS Bridge Is used in CarlaEgoVehicleControl
Message sent to CARLA
Of , So if it is ROS
And Autoware
Then you should use this package , If it is docking with other systems , such as Apollo
, Then just Apollo
The corresponding message of is transformed into CarlaEgoVehicleControl
The format is just .
4. ROS API
4.1 Subscriptions
Topic | Type | Description |
---|---|---|
/carla//ackermann_cmd | ackermann_msgs.AckermannDrive | Subscriber for steering commands |
4.2 Publications
Topic | Type | Description |
---|---|---|
/carla//ackermann_control/control_info | carla_ackermann_control.EgoVehicleControlInfo | The current values used within the controller (useful for debugging) |
边栏推荐
- C language queue
- Explore Cassandra's decentralized distributed architecture
- 2022 welder (elementary) judgment questions and online simulation examination
- Myabtis_Plus
- Visualization Document Feb 12 16:42
- LeetCode简单题之找到一个数字的 K 美丽值
- 【VHDL 并行语句执行】
- Zsh shell adds automatic completion and syntax highlighting
- 海信电视开启开发者模式
- 【数字IC验证快速入门】10、Verilog RTL设计必会的FIFO
猜你喜欢
Qt学习28 主窗口中的工具栏
2022 simulated examination question bank and online simulated examination of tea master (primary) examination questions
2022 Inner Mongolia latest advanced fire facility operator simulation examination question bank and answers
Yugu p1020 missile interception (binary search)
padavan手动安装php
数据库实时同步利器——CDC(变化数据捕获技术)
2022年全国最新消防设施操作员(初级消防设施操作员)模拟题及答案
【踩坑系列】uniapp之h5 跨域的问题
JS quick start (I)
【数字IC验证快速入门】13、SystemVerilog interface 和 program 学习
随机推荐
2022 recurrent training question bank and answers of refrigeration and air conditioning equipment operation
3D reconstruction - stereo correction
LeetCode 40:组合总和 II
Avatary的LiveDriver试用体验
jeeSite 表单页面的Excel 导入功能
Roulette chart 2 - writing of roulette chart code
这5个摸鱼神器太火了!程序员:知道了快删!
Ansible
让Livelink初始Pose与动捕演员一致
LeetCode简单题之判断一个数的数字计数是否等于数位的值
Network learning (II) -- Introduction to socket
芯片资料 网站 易特创芯
【数字IC验证快速入门】15、SystemVerilog学习之基本语法2(操作符、类型转换、循环、Task/Function...内含实践练习)
QT learning 28 toolbar in the main window
MySQL multi column index (composite index) features and usage scenarios
追风赶月莫停留,平芜尽处是春山
The charm of SQL optimization! From 30248s to 0.001s
C language queue
Bugku CTF daily one question chessboard with only black chess
Cnopendata American Golden Globe Award winning data