forked from zbw/yiliao2026
Please enter the commit message for your changes. Lines starting
with '#' will be ignored, and an empty message aborts the commit. On branch master Initial commit Changes to be committed: new file: bashes/README.md new file: bashes/radar-driver-switch.sh new file: dependencies/dependencies.txt new file: src/LSLIDAR_X_ROS2-20240228/src/README.md new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/CMakeLists.txt new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/include/lslidar_driver/input.h new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/include/lslidar_driver/lsiosr.h new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/include/lslidar_driver/lslidar_driver.h new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/launch/lslidar_double_launch.py new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/launch/lsm10_net_launch.py new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/launch/lsm10_uart_launch.py new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/launch/lsm10p_net_launch.py new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/launch/lsm10p_uart_launch.py new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/launch/lsn10_launch.py new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/launch/lsn10_net_launch.py new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/launch/lsn10p_launch.py new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/launch/lsn10p_net_launch.py new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/launch/viewer_scan_launch.py new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/package.xml new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/params/lidar_net_ros2/lsm10_net.yaml new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/params/lidar_net_ros2/lsm10p_net.yaml new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/params/lidar_net_ros2/lsn10_net.yaml new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/params/lidar_net_ros2/lsn10p_net.yaml new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/params/lidar_uart_ros2/lsm10.yaml new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/params/lidar_uart_ros2/lsm10_p.yaml new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/params/lidar_uart_ros2/lsn10.yaml new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/params/lidar_uart_ros2/lsn10p.yaml new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/rviz/lslidar.rviz new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/src/input.cc new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/src/lsiosr.cpp new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/src/lslidar_driver.cc new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/src/lslidar_driver_node.cc new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_msgs/CMakeLists.txt new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_msgs/msg/LslidarDifop.msg new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_msgs/msg/LslidarPacket.msg new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_msgs/msg/LslidarPoint.msg new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_msgs/msg/LslidarScan.msg new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_msgs/msg/LslidarSweep.msg new file: src/LSLIDAR_X_ROS2-20240228/src/lslidar_msgs/package.xml new file: src/LSLIDAR_X_ROS2-20240228/src/version.txt new file: src/LSLIDAR_X_ROS2-20240228/src/wheeltec_udev.sh new file: "src/LSLIDAR_X_ROS2-20240228/src/\351\225\255\347\245\236Lsx\351\233\267\350\276\276\346\227\213\350\275\254\350\247\222\345\272\246.png" new file: src/LSLIDAR_X_ROS2-20240228/wheeltec_lidar.launch.py new file: "src/LSLIDAR_X_ROS2-20240228/wheeltec_lidar.launch.py\344\273\205\345\234\250WHEELTEC\351\225\234\345\203\217\344\270\255\344\275\277\347\224\250" new file: src/cyy_navigation2/CMakeLists.txt new file: src/cyy_navigation2/bt/follow_point.xml new file: src/cyy_navigation2/bt/nav_to_pose_with_consistent_replanning_and_if_path_becomes_invalid.xml new file: src/cyy_navigation2/bt/navigate_through_poses_w_replanning_and_recovery.xml new file: src/cyy_navigation2/bt/navigate_to_pose_w_replanning_and_recovery.xml new file: src/cyy_navigation2/bt/navigate_to_pose_w_replanning_goal_patience_and_recovery.xml new file: src/cyy_navigation2/bt/navigate_w_recovery_and_replanning_only_if_path_becomes_invalid.xml new file: src/cyy_navigation2/bt/navigate_w_replanning_distance.xml new file: src/cyy_navigation2/bt/navigate_w_replanning_only_if_goal_is_updated.xml new file: src/cyy_navigation2/bt/navigate_w_replanning_only_if_path_becomes_invalid.xml new file: src/cyy_navigation2/bt/navigate_w_replanning_speed.xml new file: src/cyy_navigation2/bt/navigate_w_replanning_time.xml new file: src/cyy_navigation2/bt/odometry_calibration.xml new file: src/cyy_navigation2/config/nav2_params.yaml new file: src/cyy_navigation2/launch/car_bringup.launch.py new file: src/cyy_navigation2/launch/cyy_nav.launch.py new file: src/cyy_navigation2/launch/cyy_nav_box.launch.py new file: src/cyy_navigation2/maps/cyy_map.data new file: src/cyy_navigation2/maps/cyy_map.pgm new file: src/cyy_navigation2/maps/cyy_map.yaml new file: src/cyy_navigation2/maps/cyy_map1.pgm new file: src/cyy_navigation2/maps/cyy_map1.yaml new file: src/cyy_navigation2/package.xml new file: src/cyy_navigation2/param/nav2_params.yaml new file: src/cyy_navigation2/param/slam_toolbox_localization.yaml new file: src/cyy_slamtoolbox/CMakeLists.txt new file: src/cyy_slamtoolbox/config/angular_filter_example.yaml new file: src/cyy_slamtoolbox/config/box_filter_example.yaml new file: src/cyy_slamtoolbox/config/footprint_filter_example.yaml new file: src/cyy_slamtoolbox/config/intensity_filter_example.yaml new file: src/cyy_slamtoolbox/config/laser_filter_config.yaml new file: src/cyy_slamtoolbox/config/mapper_params_lifelong.yaml new file: src/cyy_slamtoolbox/config/mapper_params_localization.yaml new file: src/cyy_slamtoolbox/config/mapper_params_offline.yaml new file: src/cyy_slamtoolbox/config/mapper_params_online_async.yaml new file: src/cyy_slamtoolbox/config/mapper_params_online_sync.yaml new file: src/cyy_slamtoolbox/config/mask_filter_example.yaml new file: src/cyy_slamtoolbox/config/median_filter_example.yaml new file: src/cyy_slamtoolbox/config/median_spatial_filter_example.yaml new file: src/cyy_slamtoolbox/config/multiple_filters_example.yaml new file: src/cyy_slamtoolbox/config/pass_through_example.yaml new file: src/cyy_slamtoolbox/config/polygon_filter_example.yaml new file: src/cyy_slamtoolbox/config/range_filter_example.yaml new file: src/cyy_slamtoolbox/config/scan_blob_filter_example.yaml new file: src/cyy_slamtoolbox/config/sector_filter_example.yaml new file: src/cyy_slamtoolbox/config/shadow_filter_example.yaml new file: src/cyy_slamtoolbox/config/slam_toolbox_default.rviz new file: src/cyy_slamtoolbox/config/speckle_filter_example.yaml new file: src/cyy_slamtoolbox/launch/cyy_slam_toolbox_launch.launch.py new file: src/cyy_slamtoolbox/launch/cyy_slam_toolbox_location.launch.py new file: src/cyy_slamtoolbox/launch/filter.launch.py new file: src/cyy_slamtoolbox/package.xml new file: src/gc_navigation_fish/CMakeLists.txt new file: src/gc_navigation_fish/launch/gc_navigation.launch.py new file: src/gc_navigation_fish/maps/test_map.pgm new file: src/gc_navigation_fish/maps/test_map.yaml new file: src/gc_navigation_fish/package.xml new file: src/gc_navigation_fish/param/gc_navigation.yaml new file: src/gc_navigation_fish/param/navigation_test.yaml new file: src/gc_slam_toolbox_fish/CMakeLists.txt new file: src/gc_slam_toolbox_fish/config/gc_2d.lua new file: src/gc_slam_toolbox_fish/launch/catograph.launch.py new file: src/gc_slam_toolbox_fish/package.xml new file: src/origincar_base/CMakeLists.txt new file: src/origincar_base/config/ekf.yaml new file: src/origincar_base/config/imu.yaml new file: src/origincar_base/include/origincar_base/Quaternion_Solution.h new file: src/origincar_base/include/origincar_base/origincar_base.h new file: src/origincar_base/launch/__pycache__/testtwo.launch.cpython-38.pyc new file: src/origincar_base/launch/base_serial.launch.py new file: src/origincar_base/launch/ekf.launch.py new file: src/origincar_base/launch/origincar_bringup.launch.py new file: src/origincar_base/launch/robot_mode_description.launch.py new file: src/origincar_base/msg/Position.msg new file: src/origincar_base/package.xml new file: src/origincar_base/scripts/cmd_vel_to_ackermann_drive.py new file: src/origincar_base/src/Quaternion_Solution.cpp new file: src/origincar_base/src/origincar_base.cpp new file: src/origincar_description/CMakeLists.txt new file: src/origincar_description/CMakeLists.txt.save new file: src/origincar_description/config/joint_names_origincar_description.yaml new file: "src/origincar_description/config/joint_names_origincar_description.yaml\357\200\272Zone.Identifier" new file: src/origincar_description/launch/display.launch new file: src/origincar_description/launch/display.launch.py new file: src/origincar_description/launch/gazebo.launch new file: src/origincar_description/launch/gazebo.launch.py new file: src/origincar_description/meshes/base_link.STL new file: "src/origincar_description/meshes/base_link.STL\357\200\272Zone.Identifier" new file: src/origincar_description/meshes/down_left_Link.STL new file: "src/origincar_description/meshes/down_left_Link.STL\357\200\272Zone.Identifier" new file: src/origincar_description/meshes/down_right_Link.STL new file: "src/origincar_description/meshes/down_right_Link.STL\357\200\272Zone.Identifier" new file: src/origincar_description/meshes/up_left_Link.STL new file: "src/origincar_description/meshes/up_left_Link.STL\357\200\272Zone.Identifier" new file: src/origincar_description/meshes/up_right_Link.STL new file: "src/origincar_description/meshes/up_right_Link.STL\357\200\272Zone.Identifier" new file: src/origincar_description/package.xml new file: src/origincar_description/rviz/README new file: src/origincar_description/rviz/display.rviz new file: src/origincar_description/urdf/origincar.urdf new file: src/origincar_description/urdf/origincar.xacro new file: src/origincar_description/world/fishbot.world new file: src/origincar_description/world/gc_world.world new file: src/origincar_description/world/test.world new file: src/origincar_msg/CMakeLists.txt new file: src/origincar_msg/msg/Data.msg new file: src/origincar_msg/msg/Sign.msg new file: src/origincar_msg/package.xml new file: src/zbw_slamtoolbox/CMakeLists.txt new file: src/zbw_slamtoolbox/config/mapper_params_online_async.yaml new file: src/zbw_slamtoolbox/config/mapper_params_online_sync copy.yaml new file: src/zbw_slamtoolbox/config/navigation.yaml new file: src/zbw_slamtoolbox/launch/navigation.launch.py new file: src/zbw_slamtoolbox/launch/slamtoolbox.launch.py new file: src/zbw_slamtoolbox/package.xml new file: zbw_slamtoolbox/CMakeLists.txt new file: zbw_slamtoolbox/config/mapper_params_online_async.yaml new file: zbw_slamtoolbox/config/mapper_params_online_sync copy.yaml new file: zbw_slamtoolbox/config/navigation.yaml new file: zbw_slamtoolbox/launch/navigation.launch.py new file: zbw_slamtoolbox/launch/slamtoolbox.launch.py new file: zbw_slamtoolbox/package.xml Changes not staged for commit: deleted: zbw_slamtoolbox/CMakeLists.txt deleted: zbw_slamtoolbox/config/mapper_params_online_async.yaml deleted: zbw_slamtoolbox/config/mapper_params_online_sync copy.yaml deleted: zbw_slamtoolbox/config/navigation.yaml deleted: zbw_slamtoolbox/launch/navigation.launch.py deleted: zbw_slamtoolbox/launch/slamtoolbox.launch.py deleted: zbw_slamtoolbox/package.xml Untracked files: .gitignore
This commit is contained in:
47
src/origincar_base/scripts/cmd_vel_to_ackermann_drive.py
Normal file
47
src/origincar_base/scripts/cmd_vel_to_ackermann_drive.py
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import math
|
||||
import rclpy
|
||||
from rclpy.node import Node
|
||||
from geometry_msgs.msg import Twist
|
||||
from ackermann_msgs.msg import AckermannDriveStamped
|
||||
from rclpy.qos import QoSProfile
|
||||
|
||||
class CmdVel2AckermannDriveNode(Node):
|
||||
def __init__(self):
|
||||
super().__init__('cmd_vel_to_ackermann_drive')
|
||||
self.publisher = self.create_publisher(AckermannDriveStamped, '/ackermann_cmd', QoSProfile(depth=10))
|
||||
self.subscription = self.create_subscription(Twist, 'cmd_vel', self.cmd_callback, QoSProfile(depth=10))
|
||||
self.wheelbase = 0.143 #轮距
|
||||
self.frame_id = 'odom_combined'
|
||||
self.cmd_angle_instead_rotvel = False
|
||||
|
||||
def convert_trans_rot_vel_to_steering_angle(self, vel, omega):
|
||||
if omega == 0 or vel == 0:
|
||||
return 0
|
||||
radius = vel / omega
|
||||
return math.atan(self.wheelbase / radius)
|
||||
|
||||
def cmd_callback(self, data):
|
||||
vel = data.linear.x
|
||||
if self.cmd_angle_instead_rotvel:
|
||||
steering = data.angular.z
|
||||
else:
|
||||
steering = 1.0 * self.convert_trans_rot_vel_to_steering_angle(vel, data.angular.z)
|
||||
|
||||
msg = AckermannDriveStamped()
|
||||
msg.header.stamp = self.get_clock().now().to_msg()
|
||||
msg.header.frame_id = self.frame_id
|
||||
msg.drive.steering_angle = steering
|
||||
msg.drive.speed = vel
|
||||
self.publisher.publish(msg)
|
||||
|
||||
def main():
|
||||
rclpy.init()
|
||||
node = CmdVel2AckermannDriveNode()
|
||||
rclpy.spin(node)
|
||||
node.destroy_node()
|
||||
rclpy.shutdown()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user