Recorder bug fixes (#1752)
* Fix bug initializing structure * Fixing the end of replayer when actors continue in autopilot enabled
This commit is contained in:
parent
5d71e556f4
commit
7be45fc4a2
|
@ -1,5 +1,7 @@
|
|||
## Latest
|
||||
|
||||
* Bugfix about recorder query system
|
||||
* Fixed problem when vehicles enable autopilot after a replayer, now it works better.
|
||||
* Vulkan support: Changed project settings to make vulkan default on linux and updated make script to allow user to select opengl
|
||||
* Add ability to set motion blur settings for rgb camera in sensor python blueprint
|
||||
* Improved visual quality of the screen capture for the rgb sensor
|
||||
|
|
|
@ -268,8 +268,6 @@ std::string CarlaRecorderQuery::QueryInfo(std::string Filename, bool bShowAll)
|
|||
break;
|
||||
|
||||
default:
|
||||
// skip packet
|
||||
Info << "Unknown packet id: " << Header.Id << " at offset " << File.tellg() << std::endl;
|
||||
SkipPacket();
|
||||
break;
|
||||
}
|
||||
|
@ -441,8 +439,6 @@ std::string CarlaRecorderQuery::QueryCollisions(std::string Filename, char Categ
|
|||
break;
|
||||
|
||||
default:
|
||||
// skip packet
|
||||
Info << "Unknown packet id: " << Header.Id << " at offset " << File.tellg() << std::endl;
|
||||
SkipPacket();
|
||||
break;
|
||||
}
|
||||
|
@ -520,7 +516,7 @@ std::string CarlaRecorderQuery::QueryBlocked(std::string Filename, double MinTim
|
|||
{
|
||||
// add
|
||||
EventAdd.Read(File);
|
||||
Actors[EventAdd.DatabaseId] = ReplayerActorInfo { EventAdd.Type, EventAdd.Description.Id };
|
||||
Actors[EventAdd.DatabaseId] = ReplayerActorInfo { EventAdd.Type, EventAdd.Description.Id, FVector(0, 0, 0), 0.0, 0.0 };
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -590,8 +586,6 @@ std::string CarlaRecorderQuery::QueryBlocked(std::string Filename, double MinTim
|
|||
break;
|
||||
|
||||
default:
|
||||
// skip packet
|
||||
Info << "Unknown packet id: " << Header.Id << " at offset " << File.tellg() << std::endl;
|
||||
SkipPacket();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -359,16 +359,8 @@ void CarlaReplayer::ProcessToTime(double Time, bool IsFirstTime)
|
|||
// stop replay?
|
||||
if (CurrentTime >= TimeToStop)
|
||||
{
|
||||
// check if we need to stop the replayer and let it continue in simulation
|
||||
// mode
|
||||
if (TimeToStop < TotalTime)
|
||||
{
|
||||
Stop(true); // keep actors in scene so they continue with AI
|
||||
}
|
||||
else
|
||||
{
|
||||
Stop();
|
||||
}
|
||||
// keep actors in scene and let them continue with autopilot
|
||||
Stop(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -136,5 +136,4 @@ private:
|
|||
void UpdatePositions(double Per, double DeltaTime);
|
||||
|
||||
void InterpolatePosition(const CarlaRecorderPosition &Start, const CarlaRecorderPosition &End, double Per, double DeltaTime);
|
||||
|
||||
};
|
||||
|
|
|
@ -128,7 +128,7 @@ bool CarlaReplayerHelper::SetActorSimulatePhysics(FActorView &ActorView, bool bE
|
|||
}
|
||||
|
||||
// enable / disable autopilot for an actor
|
||||
bool CarlaReplayerHelper::SetActorAutopilot(FActorView &ActorView, bool bEnabled)
|
||||
bool CarlaReplayerHelper::SetActorAutopilot(FActorView &ActorView, bool bEnabled, bool bKeepState)
|
||||
{
|
||||
if (!ActorView.IsValid())
|
||||
{
|
||||
|
@ -144,7 +144,7 @@ bool CarlaReplayerHelper::SetActorAutopilot(FActorView &ActorView, bool bEnabled
|
|||
{
|
||||
return false;
|
||||
}
|
||||
Controller->SetAutopilot(bEnabled);
|
||||
Controller->SetAutopilot(bEnabled, bKeepState);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ std::pair<int, uint32_t> CarlaReplayerHelper::ProcessReplayerEventAdd(
|
|||
// disable physics
|
||||
SetActorSimulatePhysics(result.second, false);
|
||||
// disable autopilot
|
||||
SetActorAutopilot(result.second, false);
|
||||
SetActorAutopilot(result.second, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -351,9 +351,10 @@ bool CarlaReplayerHelper::ProcessReplayerFinish(bool bApplyAutopilot)
|
|||
SetActorSimulatePhysics(ActorView, true);
|
||||
// autopilot
|
||||
if (bApplyAutopilot)
|
||||
SetActorAutopilot(ActorView, true);
|
||||
SetActorAutopilot(ActorView, true, true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -67,5 +67,5 @@ private:
|
|||
// enable / disable physics for an actor
|
||||
bool SetActorSimulatePhysics(FActorView &ActorView, bool bEnabled);
|
||||
// enable / disable autopilot for an actor
|
||||
bool SetActorAutopilot(FActorView &ActorView, bool bEnabled);
|
||||
bool SetActorAutopilot(FActorView &ActorView, bool bEnabled, bool bKeepState = false);
|
||||
};
|
||||
|
|
|
@ -151,21 +151,25 @@ void AWheeledVehicleAIController::Tick(const float DeltaTime)
|
|||
// -- Autopilot ----------------------------------------------------------------
|
||||
// =============================================================================
|
||||
|
||||
void AWheeledVehicleAIController::ConfigureAutopilot(const bool Enable)
|
||||
void AWheeledVehicleAIController::ConfigureAutopilot(const bool Enable, const bool KeepState)
|
||||
{
|
||||
bAutopilotEnabled = Enable;
|
||||
// Reset state.
|
||||
Vehicle->SetSteeringInput(0.0f);
|
||||
Vehicle->SetThrottleInput(0.0f);
|
||||
Vehicle->SetBrakeInput(0.0f);
|
||||
Vehicle->SetReverse(false);
|
||||
Vehicle->SetHandbrakeInput(false);
|
||||
if (!KeepState)
|
||||
{
|
||||
// Reset state.
|
||||
Vehicle->SetSteeringInput(0.0f);
|
||||
Vehicle->SetThrottleInput(0.0f);
|
||||
Vehicle->SetBrakeInput(0.0f);
|
||||
Vehicle->SetReverse(false);
|
||||
Vehicle->SetHandbrakeInput(false);
|
||||
ClearQueue(TargetLocations);
|
||||
Vehicle->SetAIVehicleState(
|
||||
bAutopilotEnabled ?
|
||||
ECarlaWheeledVehicleState::FreeDriving :
|
||||
ECarlaWheeledVehicleState::AutopilotOff);
|
||||
}
|
||||
|
||||
TrafficLightState = ETrafficLightState::Green;
|
||||
ClearQueue(TargetLocations);
|
||||
Vehicle->SetAIVehicleState(
|
||||
bAutopilotEnabled ?
|
||||
ECarlaWheeledVehicleState::FreeDriving :
|
||||
ECarlaWheeledVehicleState::AutopilotOff);
|
||||
|
||||
/// @todo Workaround for a race condition between client and server when
|
||||
/// enabling autopilot right after initializing a vehicle.
|
||||
|
|
|
@ -137,11 +137,11 @@ public:
|
|||
}
|
||||
|
||||
UFUNCTION(Category = "Wheeled Vehicle Controller", BlueprintCallable)
|
||||
void SetAutopilot(bool Enable)
|
||||
void SetAutopilot(bool Enable, bool KeepState = false)
|
||||
{
|
||||
if (IsAutopilotEnabled() != Enable)
|
||||
{
|
||||
ConfigureAutopilot(Enable);
|
||||
ConfigureAutopilot(Enable, KeepState);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
void ConfigureAutopilot(bool Enable);
|
||||
void ConfigureAutopilot(const bool Enable, const bool KeepState = false);
|
||||
|
||||
/// @}
|
||||
// ===========================================================================
|
||||
|
|
Loading…
Reference in New Issue