-
Notifications
You must be signed in to change notification settings - Fork 122
Add rain and fog simulation features #359
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
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
5c50072
Initial commit with draft files
PiotrMrozik fb58bb3
Revert "Initial commit with draft files"
PiotrMrozik 6593f0a
proper skeleton of new files
PiotrMrozik 2219c60
add missing prefab
PiotrMrozik 135a298
fix broken enum
PiotrMrozik 53564a9
add fog feature setting initial commit
PiotrMrozik 0668404
Add GPU skinning in RGL (#345)
msz-rai 17a9613
Sync LiDAR's timer when enabling it (#349)
msz-rai 3079d62
Add multi-return for snow simulation (#348)
PawelLiberadzki 4c9eb78
Add test for multi-return modes.
PawelLiberadzki 9799dcc
fix api and add .so
PiotrMrozik 308db61
update docs libssl version
mackierx111 ac862cf
Initial commit with draft files
PiotrMrozik bfcd2f4
Revert "Initial commit with draft files"
PiotrMrozik 1e9aa88
proper skeleton of new files
PiotrMrozik 7d96886
add missing prefab
PiotrMrozik 994a6ce
fix broken enum
PiotrMrozik f745b0d
add fog feature setting initial commit
PiotrMrozik e9f331b
Add multi-return for snow simulation (#348)
PawelLiberadzki d5807da
fix api and add .so
PiotrMrozik 3776a89
Merge remote-tracking branch 'origin/feature/rgl-fog-simulation' into…
PiotrMrozik 4a54ff8
Make adjustments to rain simulation.
PawelLiberadzki 6a13690
add missing meta file
PiotrMrozik 0d30be8
tweak r's params
PiotrMrozik fdd4830
Merge pull request #358 from tier4/feature/rgl-rain-multi-return
PiotrMrozik 04318fe
fix merge mistake
PiotrMrozik f757478
replace binary with old file
PiotrMrozik 0420fbc
Update RGL binary for Linux
msz-rai 69ef867
pr fixes v1
PiotrMrozik 228aee9
Update RGL binary for Windows
msz-rai 7609ce6
Merge branch 'feature/rgl-fog-simulation' of github.com:tier4/AWSIM i…
PiotrMrozik 6dc2e45
Add minor code formatting updates.
PawelLiberadzki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!1 &6956985947121104793 | ||
GameObject: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
serializedVersion: 6 | ||
m_Component: | ||
- component: {fileID: 6197961024456584825} | ||
- component: {fileID: -8569641881512349866} | ||
- component: {fileID: 5029029592669420807} | ||
- component: {fileID: 2635114183252318215} | ||
m_Layer: 0 | ||
m_Name: RGLWeatherManager | ||
m_TagString: Untagged | ||
m_Icon: {fileID: 0} | ||
m_NavMeshLayer: 0 | ||
m_StaticEditorFlags: 0 | ||
m_IsActive: 1 | ||
--- !u!4 &6197961024456584825 | ||
Transform: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 6956985947121104793} | ||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} | ||
m_LocalPosition: {x: -17.985855, y: -8.897016, z: 19.096115} | ||
m_LocalScale: {x: 1, y: 1, z: 1} | ||
m_Children: [] | ||
m_Father: {fileID: 0} | ||
m_RootOrder: 0 | ||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} | ||
--- !u!114 &-8569641881512349866 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 6956985947121104793} | ||
m_Enabled: 0 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: ac280d5abd54451082c0627a0d08b1b9, type: 3} | ||
m_Name: | ||
m_EditorClassIdentifier: | ||
<IsSnowEnabled>k__BackingField: 0 | ||
<RainRate>k__BackingField: 9 | ||
<MeanSnowflakeDiameter>k__BackingField: 0.003 | ||
<TerminalVelocity>k__BackingField: 1.6 | ||
<Density>k__BackingField: 0.07 | ||
<OccupancyThreshold>k__BackingField: 0 | ||
<SnowflakesId>k__BackingField: 268435455 | ||
<FullBeamIntensity>k__BackingField: 1 | ||
--- !u!114 &5029029592669420807 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 6956985947121104793} | ||
m_Enabled: 0 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: aa72d4643994ea2d4b9e731c9454694c, type: 3} | ||
m_Name: | ||
m_EditorClassIdentifier: | ||
<IsRainEnabled>k__BackingField: 0 | ||
<RainRate>k__BackingField: 5 | ||
<RainNumericalThreshold>k__BackingField: 3 | ||
<OccupancyThreshold>k__BackingField: 0.2 | ||
<DropletsId>k__BackingField: 268435455 | ||
<FullBeamIntensity>k__BackingField: 1 | ||
--- !u!114 &2635114183252318215 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 6956985947121104793} | ||
m_Enabled: 0 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: e537672f1e918b452802a824b8840e70, type: 3} | ||
m_Name: | ||
m_EditorClassIdentifier: | ||
<IsFogEnabled>k__BackingField: 0 | ||
<AttenuationCoefficient>k__BackingField: 0.03 | ||
<NearCrossPoint>k__BackingField: 0.01 | ||
<FarCrossPoint>k__BackingField: 2 | ||
<FogId>k__BackingField: 268435455 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file modified
BIN
+0 Bytes
(100%)
Assets/RGLUnityPlugin/Plugins/Linux/x86_64/libRobotecGPULidar.so
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
Assets/RGLUnityPlugin/Plugins/Windows/x86_64/RobotecGPULidar.dll
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
// Copyright 2024 Robotec.ai. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using UnityEngine; | ||
|
||
namespace RGLUnityPlugin | ||
{ | ||
/// <summary> | ||
/// The singleton component to activate and configure the fog model for the LiDAR sensors. | ||
/// Note: This is a private feature. It requires replacing the RGL binary with the RGL private build binary. | ||
/// </summary> | ||
public class LidarFogManager : MonoBehaviour | ||
{ | ||
// Singleton pattern | ||
public static LidarFogManager Instance { get; private set; } | ||
|
||
// Delegate to notify that the snow model has been changed | ||
public delegate void OnNewConfigDelegate(); | ||
public OnNewConfigDelegate OnNewConfig; | ||
|
||
[field: Header("Base Settings")] | ||
|
||
[field: SerializeField] | ||
[field: Tooltip("Enable/disable fog effect on devices.r")] | ||
public bool IsFogEnabled { get; set; } = false; | ||
|
||
[field: SerializeField] | ||
[field: Tooltip("The attenuation coefficient for fog corresponding to amount of fog in the air")] | ||
[field: Range(0.003f, 0.5f)] | ||
public float AttenuationCoefficient { get; private set; } = 0.03f; | ||
|
||
[field: SerializeField] | ||
[field: Tooltip("Near cross-point of transmitter and receiver beams of Lidar device in meters. Model assumes that lidar is working in bistatic beam configuration.")] | ||
[field: Range(0.0f, 1.0f)] | ||
public float NearCrossPoint { get; private set; } = 0.01f; | ||
|
||
[field: SerializeField] | ||
[field: Tooltip("Far cross-point of transmitter and receiver beams of Lidar device. Model assumes that lidar is working in bistatic beam configuration.")] | ||
[field: Range(1.0f, 10.0f)] | ||
public float FarCrossPoint { get; private set; } = 2.0f; | ||
|
||
[field: Header("Defaults")] | ||
[field: SerializeField] | ||
[field: Tooltip("Entity ID that is assigned to cloud points resulting from fog hits")] | ||
public int FogId { get; private set; } = 268435455; // Default RGL entity ID. | ||
|
||
private void Awake() | ||
{ | ||
if (!IsFogFeatureAvailable()) | ||
{ | ||
Debug.LogError("Loaded RGL plugin does not include support for Lidar Fog Model, removing component"); | ||
Destroy(this); | ||
return; | ||
} | ||
|
||
if (Instance != null && Instance != this) | ||
{ | ||
Debug.LogError("LidarFogManager is already on the scene. Removing this component"); | ||
Destroy(this); | ||
return; | ||
} | ||
Instance = this; | ||
} | ||
|
||
private void OnValidate() | ||
{ | ||
OnNewConfig?.Invoke(); | ||
} | ||
|
||
private void OnEnable() | ||
{ | ||
IsFogEnabled = true; | ||
OnNewConfig?.Invoke(); | ||
} | ||
|
||
private void OnDisable() | ||
{ | ||
IsFogEnabled = false; | ||
OnNewConfig?.Invoke(); | ||
} | ||
|
||
public bool IsFogFeatureAvailable() | ||
{ | ||
return RGLNativeAPI.HasExtension(RGLExtension.RGL_EXTENSION_WEATHER); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
// Copyright 2024 Robotec.ai. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
using UnityEngine; | ||
|
||
namespace RGLUnityPlugin | ||
{ | ||
/// <summary> | ||
/// The singleton component to activate and configure the rain model for the LiDAR sensors. | ||
/// Note: This is a private feature. It requires replacing the RGL binary with the RGL private build binary. | ||
/// </summary> | ||
public class LidarRainManager : MonoBehaviour | ||
{ | ||
// Singleton pattern | ||
public static LidarRainManager Instance { get; private set; } | ||
|
||
// Delegate to notify that the rain model has been changed | ||
public delegate void OnNewConfigDelegate(); | ||
public OnNewConfigDelegate OnNewConfig; | ||
|
||
[field: Header("Base Settings")] | ||
|
||
[field: SerializeField] | ||
[field: Tooltip("Enable/disable rain effect on devices.r")] | ||
public bool IsRainEnabled { get; set; } = false; | ||
|
||
// Rain model properties | ||
[field: SerializeField] | ||
[field: Tooltip("The precipitation rate for rain is expressed in mm per hour")] | ||
[field: Range(0.0f, 10.0f)] | ||
public float RainRate { get; private set; } = 5.0f; | ||
|
||
[field: SerializeField] | ||
[field: Tooltip("Maximal number of droplets which not obstruct the lidar beam")] | ||
[field: Range(1, 5)] | ||
public int RainNumericalThreshold { get; private set; } = 3; | ||
|
||
[field: SerializeField] | ||
[field: Tooltip("Minimal beam aperture occupancy (ratio) that means a hit, both for droplets and for original hit")] | ||
[field: Range(0.0f, 1.0f)] | ||
public float OccupancyThreshold { get; private set; } = 0.2f; | ||
|
||
[field: Header("Defaults")] | ||
|
||
[field: SerializeField] | ||
[field: Tooltip("Entity ID that is assigned to cloud points resulting from droplet hits")] | ||
public int DropletsId { get; private set; } = 268435455; // Default RGL entity ID. | ||
|
||
[field: SerializeField] | ||
[field: Tooltip("Initial intensity of each LiDAR laser beam, used to evaluate energy loss based on beam aperture occupancy")] | ||
[field: Min(0.0f)] | ||
public float FullBeamIntensity { get; private set; } = 1.0f; | ||
|
||
private void Awake() | ||
{ | ||
if (!IsRainFeatureAvailable()) | ||
{ | ||
Debug.LogError("Loaded RGL plugin does not include support for Lidar Rain Model, removing component"); | ||
Destroy(this); | ||
return; | ||
} | ||
|
||
if (Instance != null && Instance != this) | ||
{ | ||
Debug.LogError("LidarRainManager is already on the scene. Removing this component"); | ||
Destroy(this); | ||
return; | ||
} | ||
Instance = this; | ||
} | ||
|
||
private void OnValidate() | ||
{ | ||
OnNewConfig?.Invoke(); | ||
} | ||
|
||
private void OnEnable() | ||
{ | ||
IsRainEnabled = true; | ||
OnNewConfig?.Invoke(); | ||
} | ||
|
||
private void OnDisable() | ||
{ | ||
IsRainEnabled = false; | ||
OnNewConfig?.Invoke(); | ||
} | ||
|
||
public bool IsRainFeatureAvailable() | ||
{ | ||
return RGLNativeAPI.HasExtension(RGLExtension.RGL_EXTENSION_WEATHER); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.