Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/flash os image #36

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/.pages
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
nav:
- 介绍: index.md
- 硬件安装
- pix底盘使用手册
- 传感器标定
- 硬件检查
- 地图
- Autoware上手
- pix底盘使用手册
- 传感器标定
- 支持
Binary file added docs/Autoware上手/images/self_driving.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 24 additions & 14 deletions docs/Autoware上手/启动autoware.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ Autoware分为模拟与实车运行两个部分,模拟运行请参考[Autoware
可以使用以下命令来启动Autoware
``` shell
ros2 launch autoware_launch autoware.launch.xml \
map_path:=$HOME/autoware_map/factory_20230325 \
map_path:=$HOME/autoware_map/factory_20230325 \ #切换成你的地图文件
vehicle_model:=pixkit \
sensor_model:=pixkit_sensor_kit
```
以上命令可分为以下5个部分

- `autoware_launch` launch文件所在的package
- `autoware.launch.xml` launch文件
- `map_path` 地图的地址参数,包含点云地图与矢量地图,地图制作方式参考[地图](../%E5%9C%B0%E5%9B%BE/index.md)
- `vehicle_model` 车辆模型参数,会根据参数来选取相应的车辆[urdf模型](https://docs.ros.org/en/humble/Tutorials/Intermediate/URDF/URDF-Main.html)与[autoware的接口](https://github.com/pixmoving-moveit/pix_driver),参考[pixkit_launch](https://github.com/pixmoving-moveit/pixkit_launch)
- `sensor_model` 传感器模型参数,会根据参数来选取相应的传感器[urdf模型](https://docs.ros.org/en/humble/Tutorials/Intermediate/URDF/URDF-Main.html)与传感器驱动,参考[pixkit_sensor_kit_launch](https://github.com/pixmoving-moveit/pixkit_sensor_kit_launch)
- `autoware_launch` launch文件所在的package
- `autoware.launch.xml` launch文件
- `map_path`: 包含点云地图(pointcloud_map.pcd)与矢量地图(lanelet2_map.osm)、地图的地址参数地图制作方式参考[地图](../%E5%9C%B0%E5%9B%BE/index.md)
- `vehicle_model` 车辆模型参数,会根据参数来选取相应的车辆[urdf模型](https://docs.ros.org/en/humble/Tutorials/Intermediate/URDF/URDF-Main.html)与[autoware的接口](https://github.com/pixmoving-moveit/pix_driver),参考[pixkit_launch](https://github.com/pixmoving-moveit/pixkit_launch)
- `sensor_model` 传感器模型参数,会根据参数来选取相应的传感器[urdf模型](https://docs.ros.org/en/humble/Tutorials/Intermediate/URDF/URDF-Main.html)与传感器驱动,参考[pixkit_sensor_kit_launch](https://github.com/pixmoving-moveit/pixkit_sensor_kit_launch)

## 启动界面
以上命令正常运行后,会出现[rviz2](https://github.com/ros2/rviz)窗口
![pix](./images/launch.png)
在可视化窗口内能够看到导入的底盘模型及点云地图与矢量地图
在可视化窗口内能够看到导入的底盘模型及您的点云地图与矢量地图
## 启动成功验证
- [验证地图是否导入](#验证地图是否导入)
- [验证车辆模型是否启动](#验证车辆模型是否导入)
Expand All @@ -30,7 +30,7 @@ sensor_model:=pixkit_sensor_kit
- 可直接观察rviz中是否有点云地图与矢量地图
- 通过[ros2 cli](https://docs.ros.org/en/foxy/Tutorials/Beginner-CLI-Tools.html)查看是否有地图数据发布,如有数据输出则表明明地图导入正常,命令如下
``` bash
ros2 top echo [topic name]
ros2 topic echo [topic name]
```

| **Topic** | **类型** | **描述** |
Expand All @@ -41,9 +41,9 @@ ros2 top echo [topic name]
### 验证车辆模型是否导入
1. 观察rviz可视化窗口中是否有车辆模型,如下图所示
![vehicle_model](./images/vehicle_model.png)
2. 查看底盘反馈是否正常,底盘反馈的topic见下表,通过[ros2 cli](https://docs.ros.org/en/foxy/Tutorials/Beginner-CLI-Tools.html)查看底盘是否通信正常,命令如下
2. 查看底盘反馈是否正常,底盘反馈的topic见下表,也通过遥控器转向查看rviz2上的deg是否变化,有变化表示已连接,若不能关闭窗口等待30s重新启动auotware观察,命令如下
``` bash
ros2 top echo [topic name]
ros2 topic echo [topic name]
```

| **Topic** | **类型** | **描述** |
Expand All @@ -56,17 +56,27 @@ ros2 top echo [topic name]
| /vehicle/status/hazard_lights_status | autoware_auto_vehicle_msgs::msg::HazardLightsReport | 底盘应急灯状态反馈 |

### 验证传感器是否正常启动
1. 通过[ros2 cli](https://docs.ros.org/en/foxy/Tutorials/Beginner-CLI-Tools.html)查看是否有传感器数据发布,如果有数据发布则表明传感器启动正常,命令如下
1. 通过[ros2 cli](https://docs.ros.org/en/foxy/Tutorials/Beginner-CLI-Tools.html)查看是否有传感器数据发布,如果有数据发布则表明传感器启动正常,若地图上显示不了点云,需要激活雷达,命令如下
``` bash
ros2 top echo [topic name]
ros2 topic echo [topic name]
```

| **Topic** | **类型** | **描述** |
| ------ | ------ | ----------- |
| /sensing/lidar/top/outlier_filtered/pointcloud | sensor_msgs/msg/PointCloud2 | LiDAR数据 |
| /sensing/imu/imu_data | sensor_msgs/msg/Imu | IMU数据 |

- 激活雷达脚本:./activte_ouster.sh

### 给定起点和终点
- 2D pose Estimate:当前车辆所在地图上的位置,需要匹配上
- 2D Goal Pose:终点
- Send Velocity Limit:填写初始速度3~5(单位KM/h),点击Send Velocity Limit发送生效
![pix](./images/lane_driving_select_init_goal_pose.gif)
### 点击AUTO按键
遥控器切换self_driving(此状态下遥控器只有紧急驻车可用),车辆进行自动驾驶时,请注意周围车辆及路,紧急停车(遥控器中心红色按钮或切回遥控模式时踩刹车)。
![pix](./images/self_driving.jpg)


## 注意事项

- 启动前需要确保地图文件存在,如map_path指定的文件夹不存在或文件不存在会导致启动失败
- 启动前需要确保地图文件存在,如map_path指定的文件夹不存在或文件不存在会导致启动失败
Binary file added docs/images/pix_chassis.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/pix_hooke.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
### 硬件构成

#### 1.[纯电开源Pix Ultra-Skateboard线控底盘](http://www.pixmoving.city/?page_id=673)
![pix-chassis](./images/pix-chassis.jpg)
![pix-chassis](./images/pix_chassis.jpg)
#### 2.传感器套件及模块化支架
![pixkit-sensors](./images/pixkit-sensors.jpg)
![pixkit-sensors](./images/pix_hooke.jpg)
#### 3.底盘工业遥控器
![remote-controller](./images/remote-controller.jpg)

Expand Down Expand Up @@ -121,7 +121,7 @@ Acc:
![lanelet2-map](./images/lanelet2-map.jpg)

### 自动驾驶软硬件文档支持
- [硬件集成](./%E7%A1%AC%E4%BB%B6%E5%AE%89%E8%A3%85/index.md)
- [硬件检查](./硬件检查/index.md)
- [pix底盘使用手册](./pix%E5%BA%95%E7%9B%98%E4%BD%BF%E7%94%A8%E6%89%8B%E5%86%8C/index.md)
- [传感器标定](./%E4%BC%A0%E6%84%9F%E5%99%A8%E6%A0%87%E5%AE%9A/camera%E5%86%85%E5%8F%82%E6%A0%87%E5%AE%9A.md)
- [地图制作](./%E5%9C%B0%E5%9B%BE/index.md)
Expand Down
9 changes: 7 additions & 2 deletions docs/传感器标定/LiDAR-camera标定.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

## 标定车辆
- hook
- 顶部激光雷达[RS-Helios-16P]
- 车头相机[SG2-OX03CC-5200-GMSL2F-H120]
- 顶部激光雷达
- 车头相机

## 前提条件

Expand All @@ -29,6 +29,11 @@

### step-1: 采集标定数据
#### 开始采集
- 启动传感器
```shell
source pix/pit-kit/Autoware/install/setup.bash
ros2 launch pixkit_sensor_kit_launch sensing.launch.xml
```
```shell
# 工作路径是标定工具根目录<sensor_calibration_tool>
./collect_script/data_collect_script/pcd_png_extractor.sh
Expand Down
1 change: 1 addition & 0 deletions docs/地图/lanelet2地图.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Lanelet2地图
## Overview
目的:通过网页导入地图(pcd格式)画图,最后导出矢量地图(lanelet2_map.osm)

[Lanelet2](https://github.com/fzi-forschungszentrum-informatik/Lanelet2)是一个处理自动驾驶地图数据的C++库,在设计Lanelet2之初,其就被用于高效地处理面向复杂交通场景的高精度地图数据。灵活性与可拓展性作为Lanelet2的核心原则,使其能够处理未来地图的新特性。

Expand Down
225 changes: 91 additions & 134 deletions docs/地图/点云地图.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,96 @@
# 点云地图制作
## Overview
目的:利用建图程序得到地图(GlobalMap.pcd)
## LIO-SAM-6AXIS
![lio-sam-6axis](./images/lio-sam.jpg)

### step-1 标定传感器 (初始参数已设置,可跳过,若建图效果不佳标定请重新标定)
- [标定IMU内参](../%E4%BC%A0%E6%84%9F%E5%99%A8%E6%A0%87%E5%AE%9A/IMU%E6%A0%87%E5%AE%9A.md)
- [标定LiDAR与IMU外参](../%E4%BC%A0%E6%84%9F%E5%99%A8%E6%A0%87%E5%AE%9A/LiDAR-IMU%E6%A0%87%E5%AE%9A.md)


### step-2 录制ros2 bag
**注意** 录制前先检查话题输出,录制话题过程中车辆尽量平稳缓速行使,建议回环的您的地图场景。

- 先启动autoware:执行./autoware.sh [排查问题](../Autoware上手/启动autoware.md)
```shell
方式一脚本录制话题: ~/pixkit/pix/ros2_bag目录下
ros2 bag record $(cat rosbag.txt)
方式二手动录制话题: ~/pixkit/pix/ros2_bag目录下
ros2 bag record /lidar_topic /gnss_topic /imu_topic
这里的 /lidar_topic:雷达设备的话题
/gnss_topic :惯导设备的话题
/imu_topic : IMU的话题
```

### step-3 修改配置文件
launch文件下run.launch:
```python3
import os
from ament_index_python.packages import get_package_share_directory
XXX
XXX

def generate_launch_description():

share_dir = get_package_share_directory('lio_sam')
parameter_file = LaunchConfiguration('params_file')
xacro_path = os.path.join(share_dir, 'config', 'robot.urdf.xacro')
rviz_config_file = os.path.join(share_dir, 'config', 'rviz2.rviz')

params_declare = DeclareLaunchArgument(
'params_file',
default_value=os.path.join(
share_dir, 'config', 'params_rs16.yaml'),
description='FPath to the ROS2 parameters file to use.')
```
`params_rs16.yaml`:读取config下的配置文件,如需改动请注意这里

- 需要修改为你的传感器配置的topic
![lio-sam-topic](./images/lio-sam-topic.jpg)

|**参数**|**msg 类型**|**描述**|
|--|--|--|
|pointCloudTopic|sensor_msgs/Pointcloud2|您录制LiDAR点云的topic|
|imuTopic|sensor_msgs/Imu|您录制IMU的topic|
|odomTopic|nav_msgs/Odometry|IMU里程计topic,不需要修改|
|gpsTopic|nav_msgs/NavSatFix|您录制gnss的定位topic|

- 如果使用GNSS进行方位初始化,需要将`useImuHeadingInitialization`设为`true`,
![gps-params](./images/gps-params.jpg)


### step-4: 运行建图程序
**注意** 结束autoware

mapping_ws下运行建图launch文件
```shell
source install/setup.bash
ros2 launch lio_sam run.launch.py
```

### step-5: 播放rosbag
```shell
ros2 bag play [your_ros2_bag] --clock
your_ros2_bag: 您录制的ros2bag,等待您的ros2bag播放结束执行以下操作
```
### step-6: 保存地图
mapping_ws文件下:
```shell
source install/setup.bash
ros2 service call /lio_sam/save_map lio_sam/srv/SaveMap
```
保存好的地图在Downloads下LOAM,将用于

|**name**|**描述**|
|--|--|
|GlobalMap.pcd|点云地图,导入[Vector Map Builder](https://tools.tier4.jp/feature/vector_map_builder_ll2/)可以画图,如果使用GNSS的话方向已经转换至ENU方向|

点云地图的原点WGS84坐标,用于GNSS定位
> 建议把终端里的信息保存下来,方便用于GNSS定位时使用
![map-origin](./images/map-origin.jpg)

## 代码git
### prerequest
- Ubuntu 22.04
- ROS2 Humble
Expand Down Expand Up @@ -36,118 +125,10 @@ sudo apt install libgtsam-dev libgtsam-unstable-dev
cd ~/mapping_ws
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
```
### step-5 标定传感器
在建图之前,需要准备好你的IMU的内参,还有LiDAR与IMU的外参

- [标定IMU内参](../%E4%BC%A0%E6%84%9F%E5%99%A8%E6%A0%87%E5%AE%9A/IMU%E6%A0%87%E5%AE%9A.md)
- [标定LiDAR与IMU外参](../%E4%BC%A0%E6%84%9F%E5%99%A8%E6%A0%87%E5%AE%9A/LiDAR-IMU%E6%A0%87%E5%AE%9A.md)

### step-6 修改配置文件
launch文件
```python3
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration, Command
from launch_ros.actions import Node


def generate_launch_description():

share_dir = get_package_share_directory('lio_sam')
parameter_file = LaunchConfiguration('params_file')
xacro_path = os.path.join(share_dir, 'config', 'robot.urdf.xacro')
rviz_config_file = os.path.join(share_dir, 'config', 'rviz2.rviz')

params_declare = DeclareLaunchArgument(
'params_file',
default_value=os.path.join(
share_dir, 'config', 'params_rs16.yaml'),
description='FPath to the ROS2 parameters file to use.')

print("urdf_file_name : {}".format(xacro_path))

return LaunchDescription([
params_declare,
Node(
package='tf2_ros',
executable='static_transform_publisher',
arguments='0.0 0.0 0.0 0.0 0.0 0.0 map odom'.split(' '),
parameters=[parameter_file],
output='screen'
),
Node(
package='robot_state_publisher',
executable='robot_state_publisher',
name='robot_state_publisher',
output='screen',
parameters=[{
'robot_description': Command(['xacro', ' ', xacro_path])
}]
),
Node(
package='lio_sam',
executable='lio_sam_imuPreintegration',
name='lio_sam_imuPreintegration',
parameters=[parameter_file],
output='screen'
),
Node(
package='lio_sam',
executable='lio_sam_imageProjection',
name='lio_sam_imageProjection',
parameters=[parameter_file],
output='screen'
),
Node(
package='lio_sam',
executable='lio_sam_featureExtraction',
name='lio_sam_featureExtraction',
parameters=[parameter_file],
output='screen'
),
Node(
package='lio_sam',
executable='lio_sam_mapOptimization',
name='lio_sam_mapOptimization',
parameters=[parameter_file],
output='screen'
),
Node(
package='lio_sam',
executable='lio_sam_simpleGpsOdom',
name='lio_sam_simpleGpsOdom',
parameters=[parameter_file],
output='screen'
),
Node(
package='rviz2',
executable='rviz2',
name='rviz2',
arguments=['-d', rviz_config_file],
output='screen'
)
])

```
需要根据launch文件修改对应的参数文件,以上述的launch文件为例,使用的参数文件是`params_rs16.yaml`,所以应该在这个文件中修改相关参数

- 需要修改为你的传感器配置的msg
![lio-sam-topic](./images/lio-sam-topic.jpg)

|**参数**|**msg 类型**|**描述**|
|--|--|--|
|pointCloudTopic|sensor_msgs/Pointcloud2|LiDAR点云的topic|
|imuTopic|sensor_msgs/Imu|IMU的topic|
|odomTopic|nav_msgs/Odometry|IMU里程计topic,不需要修改|
|gpsTopic|nav_msgs/NavSatFix|gnss的定位topic|

- 如果使用GNSS进行方位初始化,需要将`useImuHeadingInitialization`设为`true`
![gps-params](./images/gps-params.jpg)
## LiDAR参数说明

- LiDAR参数
![lidar-params](./images/lidar-params.jpg)
![lidar-params](./images/lidar-params.jpg)

|**参数**|**描述**|
|--|--|
Expand Down Expand Up @@ -186,30 +167,6 @@ def generate_launch_description():
|extrinsicTrans|平移矩阵|
|extrinsicRot|旋转矩阵|

### step-8: 运行建图程序
运行建图launch文件
```shell
ros2 launch lio_sam run.launch.py
```
播放rosbag
```shell
ros2 bag play --clock -r 3.0 -s sqlite3 [your_ros2_bag]
```

### step-7: 保存地图
```shell
ros2 service call /lio_sam/save_map lio_sam/srv/SaveMap "{resolution: 0.2, destination: [Absolute path to store your map]}"
```
保存好地图之后能够在地图文件夹内看到以下文件

|**name**|**描述**|
|--|--|
|GlobalMap.pcd|点云地图,如果使用GNSS的话方向已经转换至ENU方向|

你能够看到点云地图的原点WGS84坐标,用于GNSS定位
![map-origin](./images/map-origin.jpg)
> 建议把终端里的信息保存下来,方便用于GNSS定位时使用

## 引用
- [LIO_SAM](https://github.com/TixiaoShan/LIO-SAM)

Expand Down
Loading