From ffabf4cf3ef327672a431e1ddd15eba29255fcfe Mon Sep 17 00:00:00 2001 From: Daniel Santos-Olivan Date: Wed, 23 Sep 2020 18:15:36 +0200 Subject: [PATCH] Added ApplyForce and ApplyTorque --- LibCarla/source/carla/rpc/Command.h | 2 ++ PythonAPI/carla/source/libcarla/Commands.cpp | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/LibCarla/source/carla/rpc/Command.h b/LibCarla/source/carla/rpc/Command.h index b5cec5d66..b029b4d2e 100644 --- a/LibCarla/source/carla/rpc/Command.h +++ b/LibCarla/source/carla/rpc/Command.h @@ -209,7 +209,9 @@ namespace rpc { ApplyTargetVelocity, ApplyTargetAngularVelocity, ApplyImpulse, + ApplyForce, ApplyAngularImpulse, + ApplyTorque, SetSimulatePhysics, SetAutopilot, SetVehicleLightState>; diff --git a/PythonAPI/carla/source/libcarla/Commands.cpp b/PythonAPI/carla/source/libcarla/Commands.cpp index 1e1e8d93c..2edd79387 100644 --- a/PythonAPI/carla/source/libcarla/Commands.cpp +++ b/PythonAPI/carla/source/libcarla/Commands.cpp @@ -144,6 +144,13 @@ void export_commands() { .def_readwrite("impulse", &cr::Command::ApplyImpulse::impulse) ; + class_("ApplyForce") + .def("__init__", &command_impl::CustomInit, (arg("actor"), arg("force"))) + .def(init((arg("actor_id"), arg("force")))) + .def_readwrite("actor_id", &cr::Command::ApplyForce::actor) + .def_readwrite("force", &cr::Command::ApplyForce::force) + ; + class_("ApplyAngularImpulse") .def("__init__", &command_impl::CustomInit, (arg("actor"), arg("impulse"))) .def(init((arg("actor_id"), arg("impulse")))) @@ -151,6 +158,13 @@ void export_commands() { .def_readwrite("impulse", &cr::Command::ApplyAngularImpulse::impulse) ; + class_("ApplyTorque") + .def("__init__", &command_impl::CustomInit, (arg("actor"), arg("torque"))) + .def(init((arg("actor_id"), arg("torque")))) + .def_readwrite("actor_id", &cr::Command::ApplyTorque::actor) + .def_readwrite("torque", &cr::Command::ApplyTorque::torque) + ; + class_("SetSimulatePhysics") .def("__init__", &command_impl::CustomInit, (arg("actor"), arg("enabled"))) .def(init((arg("actor_id"), arg("enabled")))) @@ -182,7 +196,9 @@ void export_commands() { implicitly_convertible(); implicitly_convertible(); implicitly_convertible(); + implicitly_convertible(); implicitly_convertible(); + implicitly_convertible(); implicitly_convertible(); implicitly_convertible(); implicitly_convertible();