当前位置:网站首页>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) |
边栏推荐
- Merging binary trees by recursion
- 2022焊工(初级)判断题及在线模拟考试
- LeetCode 90:子集 II
- Ansible
- Visualization Document Feb 12 16:42
- Recursive method constructs binary tree from middle order and post order traversal sequence
- 复杂网络建模(二)
- Codeforce c.strange test and acwing
- Niu Mei's mathematical problem --- combinatorial number
- Zsh shell adds automatic completion and syntax highlighting
猜你喜欢
【数字IC验证快速入门】14、SystemVerilog学习之基本语法1(数组、队列、结构体、枚举、字符串...内含实践练习)
Qt学习28 主窗口中的工具栏
mysql多列索引(组合索引)特点和使用场景
2022 simulated examination question bank and online simulated examination of tea master (primary) examination questions
Li Kou interview question 04.01 Path between nodes
央视太暖心了,手把手教你写HR最喜欢的简历
Leetcode 40: combined sum II
[Matlab] Simulink 自定义函数中的矩阵乘法工作不正常时可以使用模块库中的矩阵乘法模块代替
Ansible
2022 Inner Mongolia latest advanced fire facility operator simulation examination question bank and answers
随机推荐
Qt学习28 主窗口中的工具栏
2022 simulated examination question bank and online simulated examination of tea master (primary) examination questions
央视太暖心了,手把手教你写HR最喜欢的简历
复杂网络建模(二)
Search for an element in a binary search tree (BST)
Cnopendata geographical distribution data of religious places in China
Most elements
2022焊工(初级)判断题及在线模拟考试
json 数据展平pd.json_normalize
You Li takes you to talk about C language 6 (common keywords)
Quickly use Jacobo code coverage statistics
[matlab] when matrix multiplication in Simulink user-defined function does not work properly, matrix multiplication module in module library can be used instead
太真实了,原来自己一直没有富裕起来是有原因的
[UVM practice] Chapter 2: a simple UVM verification platform (2) only driver verification platform
Force buckle 144 Preorder traversal of binary tree
Implementation of replacement function of shell script
Introduction to basic components of wechat applet
Bugku CTF daily one question chessboard with only black chess
Padavan manually installs PHP
Lattice coloring - matrix fast power optimized shape pressure DP