diff --git a/BenzObstacleDetect/BenzObstacleDetect.csproj b/BenzObstacleDetect/BenzObstacleDetect.csproj
index 18ad269..73713f2 100644
--- a/BenzObstacleDetect/BenzObstacleDetect.csproj
+++ b/BenzObstacleDetect/BenzObstacleDetect.csproj
@@ -20,7 +20,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
diff --git a/BenzObstacleDetect/Detection.cs b/BenzObstacleDetect/Detection.cs
index efd23ab..27244b4 100644
--- a/BenzObstacleDetect/Detection.cs
+++ b/BenzObstacleDetect/Detection.cs
@@ -19,8 +19,10 @@ namespace Autolabor.Benz.ObstacleDetection
private SerialRelayDriver _serialRelay;
// 算法层组件
- private LidarRoiFilter _lidarRoiFilter;
- private ObstacleDetector _obstacleDetector;
+ private LidarRoiFilter _lidarFrontRoiFilter;
+ private LidarRoiFilter _lidarRearRoiFilter;
+ private ObstacleDetector _frontObstacleDetector;
+ private ObstacleDetector _rearObstacleDetector;
private BenzObstacleControl _benzObstacleController;
// 模拟器配置
@@ -29,13 +31,15 @@ namespace Autolabor.Benz.ObstacleDetection
private IPAddress _serverIp = IPAddress.Loopback;
// 配置过滤区域
- private LidarRoi[] _lidarRois;
+ private LidarRoi[] _lidarFrontRoi;
+ private LidarRoi[] _lidarRearRoi;
public Detection(RectRoiSettings roiSettings)
{
// 1. 获取感兴趣区域
var rois = roiSettings.RectRois.Select(roi => LidarRoiFactory.Make(roi.LeftUpX, roi.LeftUpY, roi.RightDownX, roi.RightDownY)).ToList();
- _lidarRois = rois.ToArray();
+ _lidarFrontRoi = rois.Take(1).ToArray();
+ _lidarRearRoi = rois.Skip(1).ToArray();
// 2. 创建各个功能组件
// 驱动组件
@@ -43,9 +47,11 @@ namespace Autolabor.Benz.ObstacleDetection
_serialRelay = new SerialRelayDriver();
// 算法组件
- _obstacleDetector = new ObstacleDetector();
+ _frontObstacleDetector = new ObstacleDetector();
+ _rearObstacleDetector = new ObstacleDetector();
_benzObstacleController = new BenzObstacleControl();
- _lidarRoiFilter = new LidarRoiFilter();
+ _lidarRearRoiFilter = new LidarRoiFilter();
+ _lidarFrontRoiFilter = new LidarRoiFilter();
// 连接到绘图
// var lidarRender = DataRenderFactory.Make("Benz","lidar",false,true);
@@ -53,13 +59,15 @@ namespace Autolabor.Benz.ObstacleDetection
// Add(lidarRender);
// Add(obstacleRender);
// _lidarDriver.OutputLocalLidarPose2D.Connect(lidarRender.Input);
- // _obstacleDetector.OutputObstaclePoses.Connect(obstacleRender.Input);
+ // _frontObstacleDetector.OutputObstaclePoses.Connect(obstacleRender.Input);
// 3. 添加组件到容器
Add(_lidarDriver);
Add(_serialRelay);
- Add(_lidarRoiFilter);
- Add(_obstacleDetector);
+ Add(_lidarRearRoiFilter);
+ Add(_lidarFrontRoiFilter);
+ Add(_frontObstacleDetector);
+ Add(_rearObstacleDetector);
Add(_benzObstacleController);
// 4. 配置组件
@@ -81,31 +89,38 @@ namespace Autolabor.Benz.ObstacleDetection
_serialRelay.SetProperty("serial.relay.port", "/dev/autolabor_relay");
// 配置过滤器
- _lidarRoiFilter.SetProperty("roiArray", _lidarRois);
+ _lidarFrontRoiFilter.SetProperty("roiArray", _lidarFrontRoi);
+ _lidarRearRoiFilter.SetProperty("roiArray", _lidarRearRoi);
// 障碍物检测器配置
- _obstacleDetector.SetProperty("MinClusterDistance", 0.05);
- _obstacleDetector.SetProperty("MinClusterSize", 3);
- _obstacleDetector.SetProperty("MaxPrjDistance", 0.05);
- _obstacleDetector.SetProperty("GuessDistance", 1.0);
+ _frontObstacleDetector.SetProperty("MinClusterDistance", 0.05);
+ _frontObstacleDetector.SetProperty("MinClusterSize", 3);
+ _frontObstacleDetector.SetProperty("MaxPrjDistance", 0.05);
+ _frontObstacleDetector.SetProperty("GuessDistance", 1.0);
+ _rearObstacleDetector.SetProperty("MinClusterDistance", 0.05);
+ _rearObstacleDetector.SetProperty("MinClusterSize", 3);
+ _rearObstacleDetector.SetProperty("MaxPrjDistance", 0.05);
+ _rearObstacleDetector.SetProperty("GuessDistance", 1.0);
// 配置发现和丢失次数
_benzObstacleController.SetProperty("FoundObstacleThreshold", 2);
_benzObstacleController.SetProperty("LostObstacleThreshold", 3);
// 5. 连接组件
// 雷达数据流向避障检测
- _lidarDriver.OutputLocalLidarPose2D.Connect(_lidarRoiFilter.InputLidarPoints);
- _lidarRoiFilter.OutputFilteredPoints.Connect(_obstacleDetector.InputLidarPoints);
+ _lidarDriver.OutputLocalLidarPose2D.Connect(_lidarFrontRoiFilter.InputLidarPoints);
+ _lidarFrontRoiFilter.OutputFilteredPoints.Connect(_frontObstacleDetector.InputLidarPoints);
+ _lidarDriver.OutputLocalLidarPose2D.Connect(_lidarRearRoiFilter.InputLidarPoints);
+ _lidarRearRoiFilter.OutputFilteredPoints.Connect(_rearObstacleDetector.InputLidarPoints);
// 雷达诊断信号连接到奔驰障碍物控制器
_lidarDriver.OutputLidarDiagnostic.Connect(_benzObstacleController.InputLidarDiagnostics);
// 避障检测结果流向奔驰避障控制器
- _obstacleDetector.OutputObstacles.Connect(_benzObstacleController.InputObstacles);
+ _frontObstacleDetector.OutputObstacles.Connect(_benzObstacleController.InputFrontObstacles);
+ _rearObstacleDetector.OutputObstacles.Connect(_benzObstacleController.InputRearObstacles);
// 奔驰避障控制器输出到继电器
_benzObstacleController.OutputRelayControl.Connect(_serialRelay.InputRelayControl);
_benzObstacleController.OutputRelayQuery.Connect(_serialRelay.InputRelayQuery);
_serialRelay.OutputRelayFeedback.Connect(_benzObstacleController.InputRelayStatus);
_serialRelay.OutputSerialConnect.Connect(_benzObstacleController.InputSerialConnect);
-
}
}
}
\ No newline at end of file
diff --git a/Release/BenzObstacleDetect.deps.json b/Release/BenzObstacleDetect.deps.json
index be0f7e8..917419b 100644
--- a/Release/BenzObstacleDetect.deps.json
+++ b/Release/BenzObstacleDetect.deps.json
@@ -11,7 +11,7 @@
"dependencies": {
"Autolabor.Robobase": "0.3.631",
"Autolabor.Robobase.CodeGuard": "0.1.24",
- "Autolabor.Robobase.Component": "0.2.1833",
+ "Autolabor.Robobase.Component": "0.2.1851",
"Autolabor.SerialBase": "0.1.239",
"Microsoft.Extensions.Hosting": "9.0.2",
"Microsoft.NETFramework.ReferenceAssemblies": "1.0.3",
@@ -165,7 +165,7 @@
}
},
"Autolabor.Robobase.CodeGuard/0.1.24": {},
- "Autolabor.Robobase.Component/0.2.1833": {
+ "Autolabor.Robobase.Component/0.2.1851": {
"dependencies": {
"Autolabor.Robobase": "0.3.631",
"NLog": "5.1.3",
@@ -628,12 +628,12 @@
"path": "autolabor.robobase.codeguard/0.1.24",
"hashPath": "autolabor.robobase.codeguard.0.1.24.nupkg.sha512"
},
- "Autolabor.Robobase.Component/0.2.1833": {
+ "Autolabor.Robobase.Component/0.2.1851": {
"type": "package",
"serviceable": true,
- "sha512": "sha512-y7LlbK0cQiOjUpW3Z1AWfOcoYuVkKHgMD5ex00WNF2xBOYHv6vL7idDlGc8rhnxf+YNq4Ewp6OnQyHR+03NLTA==",
- "path": "autolabor.robobase.component/0.2.1833",
- "hashPath": "autolabor.robobase.component.0.2.1833.nupkg.sha512"
+ "sha512": "sha512-a+bA8OxoK6rprB6CQZ4BL+uWaNIyeAXjN+CdYZZuRLD0bAxLQNyXGRFeSBevCZXOkhzSuoEDJXbUdW+8sTsgfA==",
+ "path": "autolabor.robobase.component/0.2.1851",
+ "hashPath": "autolabor.robobase.component.0.2.1851.nupkg.sha512"
},
"Autolabor.SerialBase/0.1.239": {
"type": "package",
diff --git a/Release/BenzObstacleDetect.exe b/Release/BenzObstacleDetect.exe
index 362439e..96be9a9 100644
Binary files a/Release/BenzObstacleDetect.exe and b/Release/BenzObstacleDetect.exe differ
diff --git a/Release/BenzObstacleDetect.pdb b/Release/BenzObstacleDetect.pdb
index 9f280bc..8937662 100644
Binary files a/Release/BenzObstacleDetect.pdb and b/Release/BenzObstacleDetect.pdb differ
diff --git a/Release/componentlibrary.dll b/Release/componentlibrary.dll
index b9353d8..1519c8c 100755
Binary files a/Release/componentlibrary.dll and b/Release/componentlibrary.dll differ