Removed 'add_force' command, and little fixes.

This commit is contained in:
bernatx 2019-01-23 15:40:03 +01:00 committed by nsubiron
parent c360d1407b
commit 21bf92c5af
9 changed files with 4 additions and 43 deletions

View File

@ -12,7 +12,6 @@
- set_velocity: for setting the linear velocity
- set_angular_velocity: for setting the angular velocity
- get_angular_velocity: for getting the angular velocity
- add_force: for applying a force (in world axis)
- add_impulse: for applying an impulse (in world axis)
* Added support for gnss_sensor
* OpenDriveActor has been rewritten using the Waypoint API, this has fixed some bugs

View File

@ -48,10 +48,6 @@ namespace client {
GetEpisode().Lock()->SetActorVelocity(*this, vector);
}
void Actor::AddForce(const geom::Vector3D &vector) {
GetEpisode().Lock()->AddActorForce(*this, vector);
}
void Actor::AddImpulse(const geom::Vector3D &vector) {
GetEpisode().Lock()->AddActorImpulse(*this, vector);
}

View File

@ -67,9 +67,6 @@ namespace client {
/// Set the actor velocity.
void SetVelocity(const geom::Vector3D &vector);
/// Add force to the actor.
void AddForce(const geom::Vector3D &vector);
/// Add impulse to the actor.
void AddImpulse(const geom::Vector3D &vector);

View File

@ -156,10 +156,6 @@ namespace detail {
_pimpl->AsyncCall("set_actor_angular_velocity", actor, vector);
}
void Client::AddActorForce(const rpc::Actor &actor, const geom::Vector3D &vector) {
_pimpl->AsyncCall("add_actor_force", actor, vector);
}
void Client::AddActorImpulse(const rpc::Actor &actor, const geom::Vector3D &vector) {
_pimpl->AsyncCall("add_actor_impulse", actor, vector);
}

View File

@ -115,10 +115,6 @@ namespace detail {
const rpc::Actor &actor,
const geom::Vector3D &vector);
void AddActorForce(
const rpc::Actor &actor,
const geom::Vector3D &vector);
void AddActorImpulse(
const rpc::Actor &actor,
const geom::Vector3D &vector);

View File

@ -185,10 +185,6 @@ namespace detail {
_client.SetActorAngularVelocity(actor.Serialize(), vector);
}
void AddActorForce(const Actor &actor, const geom::Vector3D &vector) {
_client.AddActorForce(actor.Serialize(), vector);
}
void AddActorImpulse(const Actor &actor, const geom::Vector3D &vector) {
_client.AddActorImpulse(actor.Serialize(), vector);
}

View File

@ -155,7 +155,7 @@ namespace geom {
}
operator FVector() const {
return FVector{1e2f * x, 1e2f * y, 1e2f * z}; // from meters to centimeters.
return FVector{x, y, z};
}
#endif // LIBCARLA_INCLUDED_FROM_UE4

View File

@ -65,7 +65,6 @@ void export_actor() {
.def("set_transform", &cc::Actor::SetTransform, (arg("transform")))
.def("set_velocity", &cc::Actor::SetVelocity, (arg("vector")))
.def("set_angular_velocity", &cc::Actor::SetAngularVelocity, (arg("vector")))
.def("add_force", &cc::Actor::AddForce, (arg("vector")))
.def("add_impulse", &cc::Actor::AddImpulse, (arg("vector")))
.def("set_simulate_physics", &cc::Actor::SetSimulatePhysics, (arg("enabled")=true))
.def("destroy", CALL_WITHOUT_GIL(cc::Actor, Destroy))

View File

@ -318,7 +318,7 @@ void FTheNewCarlaServer::FPimpl::BindActions()
if (RootComponent == nullptr) {
RespondErrorStr("unable to get actor angular velocity: not supported by actor");
}
return cr::Vector3D(RootComponent->GetPhysicsAngularVelocityInDegrees()).ToMeters();
return cr::Vector3D(RootComponent->GetPhysicsAngularVelocityInDegrees());
});
Server.BindSync("set_actor_angular_velocity", [this](
@ -334,7 +334,7 @@ void FTheNewCarlaServer::FPimpl::BindActions()
RespondErrorStr("unable to set actor angular velocity: not supported by actor");
}
RootComponent->SetPhysicsAngularVelocityInDegrees(
vector.ToCentimeters(),
vector,
false,
"None");
});
@ -357,24 +357,6 @@ void FTheNewCarlaServer::FPimpl::BindActions()
"None");
});
Server.BindSync("add_actor_force", [this](
cr::Actor Actor,
cr::Vector3D vector) {
RequireEpisode();
auto ActorView = Episode->GetActorRegistry().Find(Actor.id);
if (!ActorView.IsValid() || ActorView.GetActor()->IsPendingKill()) {
RespondErrorStr("unable to add actor force: actor not found");
}
auto RootComponent = Cast<UPrimitiveComponent>(ActorView.GetActor()->GetRootComponent());
if (RootComponent == nullptr) {
RespondErrorStr("unable to add actor force: not supported by actor");
}
RootComponent->AddForce(
vector.ToCentimeters(),
"None",
false);
});
Server.BindSync("add_actor_impulse", [this](
cr::Actor Actor,
cr::Vector3D vector) {
@ -388,7 +370,7 @@ void FTheNewCarlaServer::FPimpl::BindActions()
RespondErrorStr("unable to add actor impulse: not supported by actor");
}
RootComponent->AddImpulse(
vector.ToCentimeters(),
vector,
"None",
false);
});