Merge branch 'master' into windows_build

This commit is contained in:
nsubiron 2018-03-12 10:26:37 +01:00
commit 72a1c95ccb
7 changed files with 21 additions and 11 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 424 KiB

After

Width:  |  Height:  |  Size: 345 KiB

View File

@ -127,11 +127,7 @@ size.
###### Transform and bounding box
The transform defines the location and orientation of the agent. The bounding
box is assumed to be centered at the agent's location. The box extent gives the
radii dimensions of the bounding box of the agent.
box is centered at the agent's location. The box extent gives the radii
dimensions of the bounding box of the agent.
![Vehicle Bounding Box](img/vehicle_bounding_box.png)
!!! important
As seen in the picture, the Z coordinate of the box is not fitted to
vehicle's height.

View File

@ -132,7 +132,6 @@ void FCarlaEncoder::Encode(
void FCarlaEncoder::Encode(const UAgentComponent &AgentComponent, carla_agent &AgentData)
{
AgentData.id = AgentComponent.GetId();
::Encode(AgentComponent.GetComponentTransform(), AgentData.transform);
FCarlaEncoder Encoder(AgentData);
AgentComponent.AcceptVisitor(Encoder);
}
@ -145,6 +144,7 @@ FCarlaEncoder::FCarlaEncoder(carla_agent &InData) : Data(InData) {}
void FCarlaEncoder::Visit(const UTrafficSignAgentComponent &Agent)
{
::Encode(Agent.GetComponentTransform(), Data.transform);
auto &TrafficSign = Agent.GetTrafficSign();
switch (TrafficSign.GetTrafficSignState()) {
case ETrafficSignState::TrafficLightRed:
@ -196,6 +196,7 @@ void FCarlaEncoder::Visit(const UTrafficSignAgentComponent &Agent)
void FCarlaEncoder::Visit(const UVehicleAgentComponent &Agent)
{
auto &Vehicle = Agent.GetVehicle();
::Encode(Vehicle.GetVehicleTransform(), Data.transform);
Data.type = CARLA_SERVER_AGENT_VEHICLE;
Data.forward_speed = Vehicle.GetVehicleForwardSpeed();
::Encode(Vehicle.GetVehicleBoundsExtent(), Data.box_extent);
@ -203,6 +204,7 @@ void FCarlaEncoder::Visit(const UVehicleAgentComponent &Agent)
void FCarlaEncoder::Visit(const UWalkerAgentComponent &Agent)
{
::Encode(Agent.GetComponentTransform(), Data.transform);
Data.type = CARLA_SERVER_AGENT_PEDESTRIAN;
Data.forward_speed = Agent.GetForwardSpeed();
::Encode(Agent.GetBoundingBoxExtent(), Data.box_extent);

View File

@ -64,7 +64,7 @@ void ACarlaVehicleController::Tick(float DeltaTime)
auto Vehicle = GetPossessedVehicle();
CarlaPlayerState->UpdateTimeStamp(DeltaTime);
const FVector PreviousSpeed = CarlaPlayerState->ForwardSpeed * CarlaPlayerState->GetOrientation();
CarlaPlayerState->Transform = Vehicle->GetActorTransform();
CarlaPlayerState->Transform = Vehicle->GetVehicleTransform();
CarlaPlayerState->ForwardSpeed = Vehicle->GetVehicleForwardSpeed();
const FVector CurrentSpeed = CarlaPlayerState->ForwardSpeed * CarlaPlayerState->GetOrientation();
CarlaPlayerState->Acceleration = (CurrentSpeed - PreviousSpeed) / DeltaTime;
@ -113,7 +113,7 @@ void ACarlaVehicleController::IntersectPlayerWithRoadMap()
auto Vehicle = GetPossessedVehicle();
constexpr float ChecksPerCentimeter = 0.1f;
auto Result = RoadMap->Intersect(
Vehicle->GetActorTransform(),
Vehicle->GetVehicleTransform(),
Vehicle->GetVehicleBoundsExtent(),
ChecksPerCentimeter);

View File

@ -37,6 +37,13 @@ ACarlaWheeledVehicle::~ACarlaWheeledVehicle() {}
// -- Get functions ------------------------------------------------------------
// =============================================================================
FTransform ACarlaWheeledVehicle::GetVehicleTransform() const
{
FTransform Transform = VehicleBounds->GetComponentTransform();
Transform.SetScale3D(GetActorTransform().GetScale3D());
return Transform;
}
float ACarlaWheeledVehicle::GetVehicleForwardSpeed() const
{
return GetVehicleMovementComponent()->GetForwardSpeed() * 0.036f;
@ -44,7 +51,7 @@ float ACarlaWheeledVehicle::GetVehicleForwardSpeed() const
FVector ACarlaWheeledVehicle::GetVehicleOrientation() const
{
return GetActorTransform().GetRotation().GetForwardVector();
return GetVehicleTransform().GetRotation().GetForwardVector();
}
int32 ACarlaWheeledVehicle::GetVehicleCurrentGear() const

View File

@ -41,6 +41,11 @@ public:
/// @{
public:
/// Transform of the vehicle. Location is shifted so it matches center of the
/// vehicle bounds rather than the actor's location.
UFUNCTION(Category = "CARLA Wheeled Vehicle", BlueprintCallable)
FTransform GetVehicleTransform() const;
/// Forward speed in km/h. Might be negative if goes backwards.
UFUNCTION(Category = "CARLA Wheeled Vehicle", BlueprintCallable)
float GetVehicleForwardSpeed() const;

View File

@ -8,4 +8,4 @@
0.6.0: 1Gw8sw01hDEV4FtpHEZZwvS-6XN0jmaLT
0.7.0: 11PKC_lG7L80L1ZxiMlzV17utU45UcRnT
0.7.1: 1gf3YaFIjwr1EaK6qxq2V-a510Brt9Imq
Latest: 1_kSLT8Q05I7zC_X0q4ABMIB8gRd-W-ZF
Latest: 1LrXnaSD0eN3aeYFeBm2jNGSnA0JHwBng