当前位置:网站首页>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) |
边栏推荐
- 芯片资料 网站 易特创芯
- uniapp 移动端强制更新功能
- Open source ecosystem | create a vibrant open source community and jointly build a new open source ecosystem!
- [matlab] when matrix multiplication in Simulink user-defined function does not work properly, matrix multiplication module in module library can be used instead
- 芯片 设计资料下载
- Shell 脚本的替换功能实现
- 运放电路的反馈电阻上并联一个电容是什么作用
- [UVM basics] summary of important knowledge points of "UVM practice" (continuous update...)
- C语言队列
- 【数字IC验证快速入门】13、SystemVerilog interface 和 program 学习
猜你喜欢
快速使用 Jacoco 代码覆盖率统计
Few shot Learning & meta learning: small sample learning principle and Siamese network structure (I)
Niu Mei's mathematical problem --- combinatorial number
Quickly use Jacobo code coverage statistics
Figure out the working principle of gpt3
【数字IC验证快速入门】15、SystemVerilog学习之基本语法2(操作符、类型转换、循环、Task/Function...内含实践练习)
2022茶艺师(初级)考试题模拟考试题库及在线模拟考试
Cnopendata list data of Chinese colleges and Universities
【數字IC驗證快速入門】15、SystemVerilog學習之基本語法2(操作符、類型轉換、循環、Task/Function...內含實踐練習)
Thinkcmf6.0 installation tutorial
随机推荐
2022茶艺师(初级)考试题模拟考试题库及在线模拟考试
Ansible
Thinkcmf6.0安装教程
【数字IC验证快速入门】10、Verilog RTL设计必会的FIFO
【数字IC验证快速入门】13、SystemVerilog interface 和 program 学习
LeetCode简单题之字符串中最大的 3 位相同数字
央视太暖心了,手把手教你写HR最喜欢的简历
Chip design data download
【数字IC验证快速入门】15、SystemVerilog学习之基本语法2(操作符、类型转换、循环、Task/Function...内含实践练习)
Es FAQ summary
力扣(LeetCode)187. 重复的DNA序列(2022.07.06)
复杂网络建模(三)
[UVM practice] Chapter 1: configuring the UVM environment (taking VCs as an example), run through the examples in the book
[quick start of Digital IC Verification] 17. Basic grammar of SystemVerilog learning 4 (randomization)
【踩坑系列】uniapp之h5 跨域的问题
DNS server configuration
Custom class loader loads network class
海信电视开启开发者模式
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after conne
Niu Mei's mathematical problem --- combinatorial number