Documentation and variable renaming for obstacle sensor

This commit is contained in:
Daniel 2019-01-29 09:44:34 +01:00 committed by nsubiron
parent 5a31efe298
commit 0bd4388e3f
4 changed files with 34 additions and 13 deletions

View File

@ -10,6 +10,7 @@
* Added support for spawning and controlling walkers (pedestrians)
* Renamed vehicle.get_vehicle_control() to vehicle.get_control() to be consistent with walkers
* Remove crash reporter from packaged build
* Added sensor for detecting obstacles
* Added a few methods to manage an actor:
- set_velocity: for setting the linear velocity
- set_angular_velocity: for setting the angular velocity

View File

@ -46,6 +46,7 @@ This is the list of sensors currently available
* [sensor.lidar.ray_cast](#sensorlidarray_cast)
* [sensor.other.collision](#sensorothercollision)
* [sensor.other.lane_detector](#sensorotherlane_detector)
* [sensor.other.obstacle](#sensorotherobstacle)
sensor.camera.rgb
-----------------
@ -305,3 +306,19 @@ objects.
| `longitude` | double | Longitude position of the actor |
| `altitude` | double | Altitude of the actor |
sensor.other.obstacle
---------------------
This sensor, when attached to an actor, reports if there is obstacles ahead.
This sensor produces
[`carla.ObstacleDetectionSensorEvent`](python_api.md#carlaobstacledetectionsensoreventdata)
objects.
| Sensor data attribute | Type | Description |
| ---------------------- | ----------- | ----------- |
| `distance` | float | Distance to throw the trace to |
| `hitradius` | float | Radius of the trace |
| `heightvar` | float | Modified height from which the trace will start and end |
| `onlydynamics` | bool | Flag to indicate that only dynamics will be traced |
| `debuglinetrace` | bool | Flag to indicate whether the linetrace will be shown or not |

View File

@ -45,11 +45,11 @@ FActorDefinition AObstacleDetectionSensor::GetSensorDefinition()
heightvar.RecommendedValues = { TEXT("100.0") };
heightvar.bRestrictToRecommended = false;
// Only Dynamics
FActorVariation onlyvehicles;
onlyvehicles.Id = TEXT("onlyvehicles");
onlyvehicles.Type = EActorAttributeType::Bool;
onlyvehicles.RecommendedValues = { TEXT("false") };
onlyvehicles.bRestrictToRecommended = false;
FActorVariation onlydynamics;
onlydynamics.Id = TEXT("onlydynamics");
onlydynamics.Type = EActorAttributeType::Bool;
onlydynamics.RecommendedValues = { TEXT("false") };
onlydynamics.bRestrictToRecommended = false;
// Debug Line Trace
FActorVariation debuglinetrace;
debuglinetrace.Id = TEXT("debuglinetrace");
@ -61,7 +61,7 @@ FActorDefinition AObstacleDetectionSensor::GetSensorDefinition()
distance,
hitradius,
heightvar,
onlyvehicles,
onlydynamics,
debuglinetrace
});
return SensorDefinition;
@ -87,10 +87,10 @@ void AObstacleDetectionSensor::Set(const FActorDescription &Description)
"heightvar",
Description.Variations,
HeightVar);
bOnlyVehicles = UActorBlueprintFunctionLibrary::RetrieveActorAttributeToBool(
"onlyvehicles",
bOnlyDynamics = UActorBlueprintFunctionLibrary::RetrieveActorAttributeToBool(
"onlydynamics",
Description.Variations,
bOnlyVehicles);
bOnlyDynamics);
bDebugLineTrace = UActorBlueprintFunctionLibrary::RetrieveActorAttributeToBool(
"debuglinetrace",
Description.Variations,
@ -159,10 +159,13 @@ void AObstacleDetectionSensor::Tick(float DeltaSeconds)
TraceParams.AddIgnoredActor(Super::GetOwner());
bool isHitReturned;
if (bOnlyVehicles)
// Choosing a type of sweep is a workaround until everything get properly
// organized under correct collision channels and object types.
if (bOnlyDynamics)
{
// If we go only for vehicles, we check the object type ECC_Vehicle
FCollisionObjectQueryParams TraceChannel = FCollisionObjectQueryParams(ECC_Vehicle);
// If we go only for dynamics, we check the object type ECC_Vehicle
FCollisionObjectQueryParams TraceChannel = FCollisionObjectQueryParams(
FCollisionObjectQueryParams::AllDynamicObjects);
isHitReturned = PlayerController->GetWorld()->SweepSingleByObjectType(
HitOut,
Start,

View File

@ -25,7 +25,7 @@ class CARLA_API AObstacleDetectionSensor : public ASensor
float HeightVar;
bool bOnlyVehicles = false;
bool bOnlyDynamics = false;
bool bDebugLineTrace = false;