update:add run step guide
This commit is contained in:
parent
fde9c007d2
commit
feee2d8315
38
README.md
38
README.md
@ -1,2 +1,38 @@
|
||||
auto drive misson center webots simulation:
|
||||
# auto drive misson center webots simulation:
|
||||
|
||||
## 1, `ubuntu20.04`, `ubuntu22.04`
|
||||
## 2, 安装 `webots`
|
||||
`https://github.com/cyberbotics/webots/tags`, 版本: `ubuntu20.04: R2023a, ubuntu22.04:R2025a`
|
||||
## 3, 创建ros2 工作空间
|
||||
如 `~/sweet_ws `, 编译 `sweet_webots_robot, robots_rviz_panel, webots_simulation, auto_drive_proj_utils,auto_drive_proj_msg, auto_drive_misson_center`
|
||||
```shell
|
||||
cd ~/sweet_ws
|
||||
colcon build --packages-select sweet_webots_robot --cmake-clean-cache
|
||||
source install/setup.bash
|
||||
colcon build --packages-select robots_rviz_panel --cmake-clean-cache
|
||||
source install/setup.bash
|
||||
colcon build --packages-select webots_simulation --cmake-clean-cache
|
||||
source install/setup.bash
|
||||
colcon build --packages-select auto_drive_proj_utils --cmake-clean-cache
|
||||
source install/setup.bash
|
||||
colcon build --packages-select auto_drive_proj_msg --cmake-clean-cache
|
||||
source install/setup.bash
|
||||
colcon build --packages-select auto_drive_misson_center --cmake-clean-cache
|
||||
source install/setup.bash
|
||||
```
|
||||
## 4, 运行 webots:
|
||||
终端执行命令: `webots`
|
||||
## 5, 运行 rviz2界面
|
||||
`ros2 launch webots_simulation robot_launch.py` ,等待rviz2界面打开后,加载配置文件:` File->Open Config->` 选择 `SweetAiRviz.rviz` ,方便起见,打开后,File->Save Config 下次不用再重复加载。该 rviz界面 左右两侧拉开留出视图空间。
|
||||
## 6, 运行 path_visualizer
|
||||
`ros2 run webots_simulation path_visualizer` ,提示 : 请输入路径文件路径: ,输入`https://test.sweetai.cn:4433/load/locationCmdPath/`中任意一个json文件名即可,如:`1699983696942006272.json`
|
||||
## 7, 模拟 `/start_pose` 服务
|
||||
另启一个终端,模拟 `/start_pose` 服务,常开,执行脚本(注意路径):`python3 /home/ada/sweet_ws/install/auto_drive_misson_center/share/auto_drive_misson_center/scripts/mock_start_pose_and_publish_rtk.py `
|
||||
## 8, 运行 mission_center 任务节点
|
||||
运行 `ros2 launch auto_drive_misson_center mission_center_launch.py` 启动 任务节点。
|
||||
## 9, 请求 /invoke/missionOn 服务
|
||||
另启一个终端,执行发送任务命令,这里的任务,必须和 `6` 中的匹配,将11699983696942006272.json1内容填充到指令中:
|
||||
```shell
|
||||
ros2 service call /invoke/missionOn auto_drive_proj_msg/srv/ReqString "{request: '[{\"name\":\"value\",\"value\":\"https://test.sweetai.cn:4433/load/locationCmdPath/1699983696942006272.json\"}]', value: ''}"
|
||||
```
|
||||
> 观察任务轨迹。
|
||||
|
||||
280
SweetAiRviz.rviz
Normal file
280
SweetAiRviz.rviz
Normal file
@ -0,0 +1,280 @@
|
||||
Panels:
|
||||
- Class: rviz_common/Displays
|
||||
Help Height: 138
|
||||
Name: Displays
|
||||
Property Tree Widget:
|
||||
Expanded:
|
||||
- /Global Options1
|
||||
- /Status1
|
||||
- /Grid1
|
||||
- /Grid1/Offset1
|
||||
- /SweetRobot1
|
||||
- /HistoryPosePath1
|
||||
- /TextInfo1
|
||||
- /TF1/Tree1
|
||||
Splitter Ratio: 0.4790419042110443
|
||||
Tree Height: 727
|
||||
- Class: rviz_common/Selection
|
||||
Name: Selection
|
||||
- Class: rviz_common/Tool Properties
|
||||
Expanded:
|
||||
- /2D Goal Pose1
|
||||
- /Publish Point1
|
||||
Name: Tool Properties
|
||||
Splitter Ratio: 0.5886790156364441
|
||||
- Class: rviz_common/Views
|
||||
Expanded:
|
||||
- /Current View1
|
||||
- /ThirdPersonFollower1
|
||||
Name: Views
|
||||
Splitter Ratio: 0.5
|
||||
- Class: sweet_rviz_panel/SweetRvizPanel
|
||||
Name: SweetRvizPanel
|
||||
Visualization Manager:
|
||||
Class: ""
|
||||
Displays:
|
||||
- Alpha: 0.699999988079071
|
||||
Cell Size: 1
|
||||
Class: rviz_default_plugins/Grid
|
||||
Color: 180; 180; 174
|
||||
Enabled: true
|
||||
Line Style:
|
||||
Line Width: 0.029999999329447746
|
||||
Value: Billboards
|
||||
Name: Grid
|
||||
Normal Cell Count: 0
|
||||
Offset:
|
||||
X: 0
|
||||
Y: 0
|
||||
Z: 0
|
||||
Plane: XY
|
||||
Plane Cell Count: 200
|
||||
Reference Frame: odom
|
||||
Value: true
|
||||
- Class: rviz_default_plugins/Marker
|
||||
Enabled: true
|
||||
Name: PlanningPath
|
||||
Namespaces:
|
||||
path: true
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
Filter size: 10
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /rviz_planning_path
|
||||
Value: true
|
||||
- Class: rviz_default_plugins/Marker
|
||||
Enabled: true
|
||||
Name: VehiclePose
|
||||
Namespaces:
|
||||
vehicle: true
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
Filter size: 10
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /rviz_vehicle_pose
|
||||
Value: true
|
||||
- Class: rviz_default_plugins/MarkerArray
|
||||
Enabled: false
|
||||
Name: MarkerArray
|
||||
Namespaces:
|
||||
{}
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /vehicle_pose_array
|
||||
Value: false
|
||||
- Alpha: 1
|
||||
Class: rviz_default_plugins/RobotModel
|
||||
Collision Enabled: true
|
||||
Description File: /home/sweetai/webots_simulation/src/sweet_webots_robot/urdf/rviz_robot.urdf
|
||||
Description Source: Topic
|
||||
Description Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /robot_description
|
||||
Enabled: true
|
||||
Links:
|
||||
All Links Enabled:
|
||||
{}
|
||||
Expand Joint Details: false
|
||||
Expand Link Details: false
|
||||
Expand Tree: false
|
||||
Link Tree Style: Links in Alphabetic Order
|
||||
base_link:
|
||||
Alpha: 1
|
||||
Show Axes: false
|
||||
Show Trail: false
|
||||
Mass Properties:
|
||||
Inertia: false
|
||||
Mass: false
|
||||
Name: SweetRobot
|
||||
TF Prefix: ""
|
||||
Update Interval: 0
|
||||
Value: true
|
||||
Visual Enabled: true
|
||||
- Class: rviz_default_plugins/Marker
|
||||
Enabled: true
|
||||
Name: HistoryPosePath
|
||||
Namespaces:
|
||||
"": true
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
Filter size: 10
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /rviz_history_traj
|
||||
Value: true
|
||||
- Class: rviz_default_plugins/Marker
|
||||
Enabled: true
|
||||
Name: TextInfo
|
||||
Namespaces:
|
||||
vehicle_info: true
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
Filter size: 10
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /rviz_text_info
|
||||
Value: true
|
||||
- Class: rviz_default_plugins/TF
|
||||
Enabled: true
|
||||
Frame Timeout: 15
|
||||
Frames:
|
||||
All Enabled: true
|
||||
base_link:
|
||||
Value: true
|
||||
odom:
|
||||
Value: true
|
||||
Marker Scale: 1
|
||||
Name: TF
|
||||
Show Arrows: true
|
||||
Show Axes: true
|
||||
Show Names: true
|
||||
Tree:
|
||||
odom:
|
||||
base_link:
|
||||
{}
|
||||
Update Interval: 0
|
||||
Value: true
|
||||
- Class: rviz_default_plugins/Axes
|
||||
Enabled: true
|
||||
Length: 3
|
||||
Name: Axes
|
||||
Radius: 0.10000000149011612
|
||||
Reference Frame: odom
|
||||
Value: true
|
||||
Enabled: true
|
||||
Global Options:
|
||||
Background Color: 48; 48; 48
|
||||
Fixed Frame: odom
|
||||
Frame Rate: 30
|
||||
Name: root
|
||||
Tools:
|
||||
- Class: rviz_default_plugins/Interact
|
||||
Hide Inactive Objects: true
|
||||
- Class: rviz_default_plugins/MoveCamera
|
||||
- Class: rviz_default_plugins/Select
|
||||
- Class: rviz_default_plugins/FocusCamera
|
||||
- Class: rviz_default_plugins/Measure
|
||||
Line color: 128; 128; 0
|
||||
- Class: rviz_default_plugins/SetInitialPose
|
||||
Covariance x: 0.25
|
||||
Covariance y: 0.25
|
||||
Covariance yaw: 0.06853891909122467
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /initialpose
|
||||
- Class: rviz_default_plugins/SetGoal
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /goal_pose
|
||||
- Class: rviz_default_plugins/PublishPoint
|
||||
Single click: true
|
||||
Topic:
|
||||
Depth: 5
|
||||
Durability Policy: Volatile
|
||||
History Policy: Keep Last
|
||||
Reliability Policy: Reliable
|
||||
Value: /clicked_point
|
||||
- Class: nav2_rviz_plugins/GoalTool
|
||||
Transformation:
|
||||
Current:
|
||||
Class: rviz_default_plugins/TF
|
||||
Value: true
|
||||
Views:
|
||||
Current:
|
||||
Class: rviz_default_plugins/ThirdPersonFollower
|
||||
Distance: 28.86780548095703
|
||||
Enable Stereo Rendering:
|
||||
Stereo Eye Separation: 0.05999999865889549
|
||||
Stereo Focal Distance: 1
|
||||
Swap Stereo Eyes: false
|
||||
Value: false
|
||||
Focal Point:
|
||||
X: 1.0536713600158691
|
||||
Y: -0.3854414224624634
|
||||
Z: -0.37999600172042847
|
||||
Focal Shape Fixed Size: true
|
||||
Focal Shape Size: 0.05000000074505806
|
||||
Invert Z Axis: false
|
||||
Name: Current View
|
||||
Near Clip Distance: 0.009999999776482582
|
||||
Pitch: 0.5747960805892944
|
||||
Target Frame: base_link
|
||||
Value: ThirdPersonFollower (rviz_default_plugins)
|
||||
Yaw: 2.934211492538452
|
||||
Saved:
|
||||
- Class: rviz_default_plugins/ThirdPersonFollower
|
||||
Distance: 10.54976749420166
|
||||
Enable Stereo Rendering:
|
||||
Stereo Eye Separation: 0.05999999865889549
|
||||
Stereo Focal Distance: 1
|
||||
Swap Stereo Eyes: false
|
||||
Value: false
|
||||
Focal Point:
|
||||
X: 1.0536713600158691
|
||||
Y: -0.3854414224624634
|
||||
Z: -0.37999600172042847
|
||||
Focal Shape Fixed Size: true
|
||||
Focal Shape Size: 0.05000000074505806
|
||||
Invert Z Axis: false
|
||||
Name: ThirdPersonFollower
|
||||
Near Clip Distance: 0.009999999776482582
|
||||
Pitch: 0.4897962808609009
|
||||
Target Frame: base_link
|
||||
Value: ThirdPersonFollower (rviz_default_plugins)
|
||||
Yaw: 3.124211072921753
|
||||
Window Geometry:
|
||||
Displays:
|
||||
collapsed: false
|
||||
Height: 1016
|
||||
Hide Left Dock: false
|
||||
Hide Right Dock: false
|
||||
QMainWindow State: 000000ff00000000fd0000000400000000000001560000039efc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d0000039e000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c0000026100000001000001180000039efc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fc0000003d0000039e000000c10100001cfa000000010100000002fb0000001c00530077006500650074005200760069007a00500061006e0065006c0100000000ffffffff000000a000fffffffb0000000a0056006900650077007301000009240000035c0000010000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000c800000022cfc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d00650100000000000004500000000000000000000004b00000039e00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
|
||||
Selection:
|
||||
collapsed: false
|
||||
SweetRvizPanel:
|
||||
collapsed: false
|
||||
Tool Properties:
|
||||
collapsed: false
|
||||
Views:
|
||||
collapsed: false
|
||||
Width: 1834
|
||||
X: 86
|
||||
Y: 27
|
||||
@ -20,20 +20,20 @@ class MockPoseNode(Node):
|
||||
)
|
||||
self.get_logger().info("Service /start_pose ready, always return success=True")
|
||||
|
||||
# 2. rtk_pose publisher
|
||||
self.pub_rtk = self.create_publisher(
|
||||
PoseWithCovarianceStamped,
|
||||
"/rtk_pose",
|
||||
10
|
||||
)
|
||||
# # 2. rtk_pose publisher
|
||||
# self.pub_rtk = self.create_publisher(
|
||||
# PoseWithCovarianceStamped,
|
||||
# "/rtk_pose",
|
||||
# 10
|
||||
# )
|
||||
|
||||
self.url = url
|
||||
self.coord_list = []
|
||||
self.load_geojson()
|
||||
# self.url = url
|
||||
# self.coord_list = []
|
||||
# self.load_geojson()
|
||||
|
||||
self.index = 0
|
||||
self.timer_period = 0.2
|
||||
self.timer = self.create_timer(self.timer_period, self.publish_rtk_pose_cb)
|
||||
# self.index = 0
|
||||
# self.timer_period = 0.2
|
||||
# self.timer = self.create_timer(self.timer_period, self.publish_rtk_pose_cb)
|
||||
|
||||
def load_geojson(self):
|
||||
try:
|
||||
@ -53,33 +53,33 @@ class MockPoseNode(Node):
|
||||
response.success = True
|
||||
return response
|
||||
|
||||
def publish_rtk_pose_cb(self):
|
||||
if not self.coord_list:
|
||||
return
|
||||
# def publish_rtk_pose_cb(self):
|
||||
# if not self.coord_list:
|
||||
# return
|
||||
|
||||
lon, lat, alt = self.coord_list[self.index]
|
||||
# lon, lat, alt = self.coord_list[self.index]
|
||||
|
||||
msg = PoseWithCovarianceStamped()
|
||||
msg.header.stamp = self.get_clock().now().to_msg()
|
||||
msg.header.frame_id = "enu"
|
||||
# msg = PoseWithCovarianceStamped()
|
||||
# msg.header.stamp = self.get_clock().now().to_msg()
|
||||
# msg.header.frame_id = "enu"
|
||||
|
||||
msg.pose.pose.position.x = lon
|
||||
msg.pose.pose.position.y = lat
|
||||
msg.pose.pose.position.z = alt
|
||||
# msg.pose.pose.position.x = lon
|
||||
# msg.pose.pose.position.y = lat
|
||||
# msg.pose.pose.position.z = alt
|
||||
|
||||
msg.pose.pose.orientation.w = 1.0
|
||||
msg.pose.pose.orientation.x = 0.0
|
||||
msg.pose.pose.orientation.y = 0.0
|
||||
msg.pose.pose.orientation.z = 0.0
|
||||
# msg.pose.pose.orientation.w = 1.0
|
||||
# msg.pose.pose.orientation.x = 0.0
|
||||
# msg.pose.pose.orientation.y = 0.0
|
||||
# msg.pose.pose.orientation.z = 0.0
|
||||
|
||||
for i in range(36):
|
||||
msg.pose.covariance[i] = 0.0
|
||||
# for i in range(36):
|
||||
# msg.pose.covariance[i] = 0.0
|
||||
|
||||
self.pub_rtk.publish(msg)
|
||||
# self.pub_rtk.publish(msg)
|
||||
|
||||
self.index += 1
|
||||
if self.index >= len(self.coord_list):
|
||||
self.index = 0
|
||||
# self.index += 1
|
||||
# if self.index >= len(self.coord_list):
|
||||
# self.index = 0
|
||||
|
||||
|
||||
def main(args=None):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user