From 21bf92c5afe2eb905529974b6dbbf514811cf2eb Mon Sep 17 00:00:00 2001 From: bernatx Date: Wed, 23 Jan 2019 15:40:03 +0100 Subject: [PATCH] Removed 'add_force' command, and little fixes. --- CHANGELOG.md | 1 - LibCarla/source/carla/client/Actor.cpp | 4 ---- LibCarla/source/carla/client/Actor.h | 3 --- .../source/carla/client/detail/Client.cpp | 4 ---- LibCarla/source/carla/client/detail/Client.h | 4 ---- .../source/carla/client/detail/Simulator.h | 4 ---- LibCarla/source/carla/geom/Vector3D.h | 2 +- PythonAPI/source/libcarla/Actor.cpp | 1 - .../Source/Carla/Server/TheNewCarlaServer.cpp | 24 +++---------------- 9 files changed, 4 insertions(+), 43 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f003da250..7e2469355 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/LibCarla/source/carla/client/Actor.cpp b/LibCarla/source/carla/client/Actor.cpp index 99ea9423a..e66732f7b 100644 --- a/LibCarla/source/carla/client/Actor.cpp +++ b/LibCarla/source/carla/client/Actor.cpp @@ -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); } diff --git a/LibCarla/source/carla/client/Actor.h b/LibCarla/source/carla/client/Actor.h index 7585576fb..0a1cfa73c 100644 --- a/LibCarla/source/carla/client/Actor.h +++ b/LibCarla/source/carla/client/Actor.h @@ -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); diff --git a/LibCarla/source/carla/client/detail/Client.cpp b/LibCarla/source/carla/client/detail/Client.cpp index 2503e46ef..954412711 100644 --- a/LibCarla/source/carla/client/detail/Client.cpp +++ b/LibCarla/source/carla/client/detail/Client.cpp @@ -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); } diff --git a/LibCarla/source/carla/client/detail/Client.h b/LibCarla/source/carla/client/detail/Client.h index 94b849c45..3d891126a 100644 --- a/LibCarla/source/carla/client/detail/Client.h +++ b/LibCarla/source/carla/client/detail/Client.h @@ -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); diff --git a/LibCarla/source/carla/client/detail/Simulator.h b/LibCarla/source/carla/client/detail/Simulator.h index 8a518381d..76aab1c45 100644 --- a/LibCarla/source/carla/client/detail/Simulator.h +++ b/LibCarla/source/carla/client/detail/Simulator.h @@ -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); } diff --git a/LibCarla/source/carla/geom/Vector3D.h b/LibCarla/source/carla/geom/Vector3D.h index 5330978df..bf331a82c 100644 --- a/LibCarla/source/carla/geom/Vector3D.h +++ b/LibCarla/source/carla/geom/Vector3D.h @@ -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 diff --git a/PythonAPI/source/libcarla/Actor.cpp b/PythonAPI/source/libcarla/Actor.cpp index 4f9c694f2..182045e69 100644 --- a/PythonAPI/source/libcarla/Actor.cpp +++ b/PythonAPI/source/libcarla/Actor.cpp @@ -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)) diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Server/TheNewCarlaServer.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Server/TheNewCarlaServer.cpp index 621baef7d..561016e5a 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Server/TheNewCarlaServer.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Server/TheNewCarlaServer.cpp @@ -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(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); });