当前位置:网站首页>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) |
边栏推荐
- Explore dry goods! Apifox construction ideas
- Yugu p1020 missile interception (binary search)
- C语言二叉树与建堆
- 让Livelink初始Pose与动捕演员一致
- Shell 脚本的替换功能实现
- Detailed explanation of Kalman filter for motion state estimation
- Li Kou interview question 04.01 Path between nodes
- [Matlab] Simulink 自定义函数中的矩阵乘法工作不正常时可以使用模块库中的矩阵乘法模块代替
- Binary tree and heap building in C language
- Wechat applet data binding multiple data
猜你喜欢
运放电路的反馈电阻上并联一个电容是什么作用
Custom class loader loads network class
Open source ecosystem | create a vibrant open source community and jointly build a new open source ecosystem!
Figure out the working principle of gpt3
2022 recurrent training question bank and answers of refrigeration and air conditioning equipment operation
2022 Inner Mongolia latest advanced fire facility operator simulation examination question bank and answers
[Matlab] Simulink 自定义函数中的矩阵乘法工作不正常时可以使用模块库中的矩阵乘法模块代替
Es FAQ summary
Content of string
Linux server development, MySQL index principle and optimization
随机推荐
有 Docker 谁还在自己本地安装 Mysql ?
Topic not received? Try this
【数字IC验证快速入门】13、SystemVerilog interface 和 program 学习
uniapp 移动端强制更新功能
[quick start of Digital IC Verification] 17. Basic grammar of SystemVerilog learning 4 (randomization)
微信小程序基本组件使用介绍
贝叶斯定律
You Li takes you to talk about C language 6 (common keywords)
Content of string
青龙面板--花花阅读
MySQL multi column index (composite index) features and usage scenarios
快解析内网穿透为文档加密行业保驾护航
Cnopendata geographical distribution data of religious places in China
【数字IC验证快速入门】10、Verilog RTL设计必会的FIFO
C language communication travel card background system
Explore Cassandra's decentralized distributed architecture
Chip information website Yite Chuangxin
The zblog plug-in supports the plug-in pushed by Baidu Sogou 360
[quickstart to Digital IC Validation] 15. Basic syntax for SystemVerilog Learning 2 (operator, type conversion, loop, Task / Function... Including practical exercises)
太真实了,原来自己一直没有富裕起来是有原因的