Fix some Unreal and PythonAPI build errors. (#8162)
This commit is contained in:
parent
930fd57fbb
commit
001604da6b
|
@ -37,7 +37,7 @@ namespace carla {
|
||||||
bool traction_control_enabled = false;
|
bool traction_control_enabled = false;
|
||||||
float max_wheelspin_rotation = 30;
|
float max_wheelspin_rotation = 30;
|
||||||
uint8_t external_torque_combine_method = 0; // @TODO INTRODUCE ENUM
|
uint8_t external_torque_combine_method = 0; // @TODO INTRODUCE ENUM
|
||||||
std::vector<geom::Vector2D> lateral_slip_graph;
|
std::vector<geom::Vector2D> lateral_slip_graph = {};
|
||||||
geom::Vector3D suspension_axis = geom::Vector3D(0, 0, -1);
|
geom::Vector3D suspension_axis = geom::Vector3D(0, 0, -1);
|
||||||
geom::Vector3D suspension_force_offset = geom::Vector3D(0, 0, 0);
|
geom::Vector3D suspension_force_offset = geom::Vector3D(0, 0, 0);
|
||||||
float suspension_max_raise = 10.0f;
|
float suspension_max_raise = 10.0f;
|
||||||
|
|
|
@ -466,15 +466,45 @@ namespace rpc {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::ostream &operator<<(std::ostream &out, const WheelPhysicsControl &control) {
|
inline std::ostream &operator<<(std::ostream &out, const WheelPhysicsControl &control) {
|
||||||
out << "WheelPhysicsControl(tire_friction=" << std::to_string(control.tire_friction)
|
out << "WheelPhysicsControl(axle_type=" << std::to_string(control.axle_type)
|
||||||
<< ", max_steer_angle=" << std::to_string(control.max_steer_angle)
|
<< ", offset" << control.offset
|
||||||
<< ", radius=" << std::to_string(control.radius)
|
<< ", wheel_radius=" << std::to_string(control.wheel_radius)
|
||||||
<< ", cornering_stiffness=" << std::to_string(control.cornering_stiffness)
|
<< ", wheel_width=" << std::to_string(control.wheel_width)
|
||||||
<< ", abs=" << std::to_string(control.abs)
|
<< ", wheel_mass=" << std::to_string(control.wheel_mass)
|
||||||
<< ", traction_control=" << std::to_string(control.traction_control)
|
<< ", cornering_stiffness=" << std::to_string(control.cornering_stiffness)
|
||||||
<< ", max_brake_torque=" << std::to_string(control.max_brake_torque)
|
<< ", friction_force_multiplier=" << std::to_string(control.friction_force_multiplier)
|
||||||
<< ", max_handbrake_torque=" << std::to_string(control.max_handbrake_torque)
|
<< ", side_slip_modifier=" << std::to_string(control.side_slip_modifier)
|
||||||
<< ", position=" << control.position << ')';
|
<< ", slip_threshold=" << std::to_string(control.slip_threshold)
|
||||||
|
<< ", skid_threshold=" << std::to_string(control.skid_threshold)
|
||||||
|
<< ", max_steer_angle=" << std::to_string(control.max_steer_angle)
|
||||||
|
<< ", affected_by_steering=" << std::to_string(control.affected_by_steering)
|
||||||
|
<< ", affected_by_brake=" << std::to_string(control.affected_by_brake)
|
||||||
|
<< ", affected_by_handbrake=" << std::to_string(control.affected_by_handbrake)
|
||||||
|
<< ", affected_by_engine=" << std::to_string(control.affected_by_engine)
|
||||||
|
<< ", abs_enabled=" << std::to_string(control.abs_enabled)
|
||||||
|
<< ", traction_control_enabled=" << std::to_string(control.traction_control_enabled)
|
||||||
|
<< ", max_wheelspin_rotation=" << std::to_string(control.max_wheelspin_rotation)
|
||||||
|
<< ", external_torque_combine_method=" << std::to_string(control.external_torque_combine_method)
|
||||||
|
<< ", lateral_slip_graph=" << control.lateral_slip_graph
|
||||||
|
<< ", suspension_axis=" << control.suspension_axis
|
||||||
|
<< ", suspension_force_offset=" << control.suspension_force_offset
|
||||||
|
<< ", suspension_max_raise=" << std::to_string(control.suspension_max_raise)
|
||||||
|
<< ", suspension_max_drop=" << std::to_string(control.suspension_max_drop)
|
||||||
|
<< ", suspension_damping_ratio=" << std::to_string(control.suspension_damping_ratio)
|
||||||
|
<< ", wheel_load_ratio=" << std::to_string(control.wheel_load_ratio)
|
||||||
|
<< ", spring_rate=" << std::to_string(control.spring_rate)
|
||||||
|
<< ", spring_preload=" << std::to_string(control.spring_preload)
|
||||||
|
<< ", suspension_smoothing=" << std::to_string(control.suspension_smoothing)
|
||||||
|
<< ", rollbar_scaling=" << std::to_string(control.rollbar_scaling)
|
||||||
|
<< ", sweep_shape=" << std::to_string(control.sweep_shape)
|
||||||
|
<< ", sweep_type=" << std::to_string(control.sweep_type)
|
||||||
|
<< ", max_brake_torque=" << std::to_string(control.max_brake_torque)
|
||||||
|
<< ", max_hand_brake_torque=" << std::to_string(control.max_hand_brake_torque)
|
||||||
|
<< ", wheel_index=" << std::to_string(control.wheel_index)
|
||||||
|
<< ", location=" << control.location
|
||||||
|
<< ", old_location=" << control.old_location
|
||||||
|
<< ", velocity=" << control.velocity
|
||||||
|
<< ')';
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,7 +536,7 @@ namespace rpc {
|
||||||
<< ", inertia_tensor_scale=" << control.inertia_tensor_scale
|
<< ", inertia_tensor_scale=" << control.inertia_tensor_scale
|
||||||
<< ", sleep_threshold=" << control.sleep_threshold
|
<< ", sleep_threshold=" << control.sleep_threshold
|
||||||
<< ", sleep_slope_limit=" << control.sleep_slope_limit
|
<< ", sleep_slope_limit=" << control.sleep_slope_limit
|
||||||
<< ", steering_curv=" << control.steering_curve
|
<< ", steering_curve=" << control.steering_curve
|
||||||
<< ", wheels=" << control.wheels
|
<< ", wheels=" << control.wheels
|
||||||
<< ", use_sweep_wheel_collision=" << control.use_sweep_wheel_collision
|
<< ", use_sweep_wheel_collision=" << control.use_sweep_wheel_collision
|
||||||
<< ")";
|
<< ")";
|
||||||
|
|
|
@ -46,7 +46,7 @@ static auto GetVectorOfBoneTransformFromList(const boost::python::list &list) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static auto GetWheels(const carla::rpc::VehiclePhysicsControl &self) {
|
static auto GetWheels(const carla::rpc::VehiclePhysicsControl &self) {
|
||||||
const auto &wheels = self.GetWheels();
|
auto &wheels = self.wheels;
|
||||||
boost::python::object get_iter = boost::python::iterator<std::vector<carla::rpc::WheelPhysicsControl>>();
|
boost::python::object get_iter = boost::python::iterator<std::vector<carla::rpc::WheelPhysicsControl>>();
|
||||||
boost::python::object iter = get_iter(wheels);
|
boost::python::object iter = get_iter(wheels);
|
||||||
return boost::python::list(iter);
|
return boost::python::list(iter);
|
||||||
|
@ -62,7 +62,7 @@ static void SetWheels(carla::rpc::VehiclePhysicsControl &self, const boost::pyth
|
||||||
}
|
}
|
||||||
|
|
||||||
static auto GetForwardGearRatios(const carla::rpc::VehiclePhysicsControl &self) {
|
static auto GetForwardGearRatios(const carla::rpc::VehiclePhysicsControl &self) {
|
||||||
const auto &gears = self.GetForwardGearRatios();
|
auto &gears = self.forward_gear_ratios;
|
||||||
boost::python::object get_iter = boost::python::iterator<std::vector<float>>();
|
boost::python::object get_iter = boost::python::iterator<std::vector<float>>();
|
||||||
boost::python::object iter = get_iter(gears);
|
boost::python::object iter = get_iter(gears);
|
||||||
return boost::python::list(iter);
|
return boost::python::list(iter);
|
||||||
|
@ -74,11 +74,11 @@ static void SetForwardGearRatios(carla::rpc::VehiclePhysicsControl &self, const
|
||||||
for (auto i = 0u; i < length; ++i) {
|
for (auto i = 0u; i < length; ++i) {
|
||||||
gears.push_back(boost::python::extract<float &>(list[i]));
|
gears.push_back(boost::python::extract<float &>(list[i]));
|
||||||
}
|
}
|
||||||
self.SetForwardGearRatios(gears);
|
self.forward_gear_ratios = gears;
|
||||||
}
|
}
|
||||||
|
|
||||||
static auto GetReverseGearRatios(const carla::rpc::VehiclePhysicsControl &self) {
|
static auto GetReverseGearRatios(const carla::rpc::VehiclePhysicsControl &self) {
|
||||||
const auto &gears = self.GetReverseGearRatios();
|
auto &gears = self.reverse_gear_ratios;
|
||||||
boost::python::object get_iter = boost::python::iterator<std::vector<float>>();
|
boost::python::object get_iter = boost::python::iterator<std::vector<float>>();
|
||||||
boost::python::object iter = get_iter(gears);
|
boost::python::object iter = get_iter(gears);
|
||||||
return boost::python::list(iter);
|
return boost::python::list(iter);
|
||||||
|
@ -90,11 +90,11 @@ static void SetReverseGearRatios(carla::rpc::VehiclePhysicsControl &self, const
|
||||||
for (auto i = 0u; i < length; ++i) {
|
for (auto i = 0u; i < length; ++i) {
|
||||||
gears.push_back(boost::python::extract<float &>(list[i]));
|
gears.push_back(boost::python::extract<float &>(list[i]));
|
||||||
}
|
}
|
||||||
self.SetReverseGearRatios(gears);
|
self.reverse_gear_ratios = gears;
|
||||||
}
|
}
|
||||||
|
|
||||||
static auto GetTorqueCurve(const carla::rpc::VehiclePhysicsControl &self) {
|
static auto GetTorqueCurve(const carla::rpc::VehiclePhysicsControl &self) {
|
||||||
const std::vector<carla::geom::Vector2D> &torque_curve = self.GetTorqueCurve();
|
auto &torque_curve = self.torque_curve;
|
||||||
boost::python::object get_iter = boost::python::iterator<const std::vector<carla::geom::Vector2D>>();
|
boost::python::object get_iter = boost::python::iterator<const std::vector<carla::geom::Vector2D>>();
|
||||||
boost::python::object iter = get_iter(torque_curve);
|
boost::python::object iter = get_iter(torque_curve);
|
||||||
return boost::python::list(iter);
|
return boost::python::list(iter);
|
||||||
|
@ -105,7 +105,7 @@ static void SetTorqueCurve(carla::rpc::VehiclePhysicsControl &self, const boost:
|
||||||
}
|
}
|
||||||
|
|
||||||
static auto GetSteeringCurve(const carla::rpc::VehiclePhysicsControl &self) {
|
static auto GetSteeringCurve(const carla::rpc::VehiclePhysicsControl &self) {
|
||||||
const std::vector<carla::geom::Vector2D> &steering_curve = self.GetSteeringCurve();
|
auto &steering_curve = self.steering_curve;
|
||||||
boost::python::object get_iter = boost::python::iterator<const std::vector<carla::geom::Vector2D>>();
|
boost::python::object get_iter = boost::python::iterator<const std::vector<carla::geom::Vector2D>>();
|
||||||
boost::python::object iter = get_iter(steering_curve);
|
boost::python::object iter = get_iter(steering_curve);
|
||||||
return boost::python::list(iter);
|
return boost::python::list(iter);
|
||||||
|
@ -170,6 +170,69 @@ boost::python::object VehiclePhysicsControl_init(boost::python::tuple args, boos
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::python::object WheelPhysicsControl_init(boost::python::tuple args, boost::python::dict kwargs) {
|
||||||
|
// Args names
|
||||||
|
const char* const args_names[] = {
|
||||||
|
"axle_type",
|
||||||
|
"offset",
|
||||||
|
"wheel_radius",
|
||||||
|
"wheel_width",
|
||||||
|
"wheel_mass",
|
||||||
|
"cornering_stiffness",
|
||||||
|
"friction_force_multiplier",
|
||||||
|
"side_slip_modifier",
|
||||||
|
"slip_threshold",
|
||||||
|
"skid_threshold",
|
||||||
|
"max_steer_angle",
|
||||||
|
"affected_by_steering",
|
||||||
|
"affected_by_brake",
|
||||||
|
"affected_by_handbrake",
|
||||||
|
"affected_by_engine",
|
||||||
|
"abs_enabled",
|
||||||
|
"traction_control_enabled",
|
||||||
|
"max_wheelspin_rotation",
|
||||||
|
"external_torque_combine_method",
|
||||||
|
"lateral_slip_graph",
|
||||||
|
"suspension_axis",
|
||||||
|
"suspension_force_offset",
|
||||||
|
"suspension_max_raise",
|
||||||
|
"suspension_max_drop",
|
||||||
|
"suspension_damping_ratio",
|
||||||
|
"wheel_load_ratio",
|
||||||
|
"spring_rate",
|
||||||
|
"spring_preload",
|
||||||
|
"suspension_smoothing",
|
||||||
|
"rollbar_scaling",
|
||||||
|
"sweep_shape",
|
||||||
|
"sweep_type",
|
||||||
|
"max_brake_torque",
|
||||||
|
"max_hand_brake_torque",
|
||||||
|
"wheel_index",
|
||||||
|
"location",
|
||||||
|
"old_location",
|
||||||
|
"velocity",
|
||||||
|
};
|
||||||
|
const auto NUM_ARGUMENTS = sizeof(args_names) / sizeof(const char*);
|
||||||
|
|
||||||
|
boost::python::object self = args[0];
|
||||||
|
args = boost::python::tuple(args.slice(1, boost::python::_));
|
||||||
|
|
||||||
|
auto res = self.attr("__init__")();
|
||||||
|
if (len(args) > 0) {
|
||||||
|
for (unsigned int i = 0; i < len(args); ++i) {
|
||||||
|
self.attr(args_names[i]) = args[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < NUM_ARGUMENTS; ++i) {
|
||||||
|
if (kwargs.contains(args_names[i])) {
|
||||||
|
self.attr(args_names[i]) = kwargs[args_names[i]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
static auto GetBonesTransform(const carla::rpc::WalkerBoneControlIn &self) {
|
static auto GetBonesTransform(const carla::rpc::WalkerBoneControlIn &self) {
|
||||||
const std::vector<carla::rpc::BoneTransformDataIn> &bone_transform_data = self.bone_transforms;
|
const std::vector<carla::rpc::BoneTransformDataIn> &bone_transform_data = self.bone_transforms;
|
||||||
boost::python::object get_iter =
|
boost::python::object get_iter =
|
||||||
|
@ -341,26 +404,48 @@ void export_control() {
|
||||||
.def(self_ns::str(self_ns::self))
|
.def(self_ns::str(self_ns::self))
|
||||||
;
|
;
|
||||||
|
|
||||||
class_<cr::WheelPhysicsControl>("WheelPhysicsControl")
|
|
||||||
.def(init<float, float, float, float, bool, bool, float, float, cg::Vector3D>(
|
class_<cr::WheelPhysicsControl>("WheelPhysicsControl", no_init)
|
||||||
(arg("tire_friction")=3.0f,
|
.def("__init__", raw_function(WheelPhysicsControl_init))
|
||||||
arg("max_steer_angle")=70.0f,
|
.def(init<>())
|
||||||
arg("radius")=30.0f,
|
.def_readwrite("axle_type", &cr::WheelPhysicsControl::axle_type)
|
||||||
arg("cornering_stiffness")=1000.0f,
|
.def_readwrite("offset", &cr::WheelPhysicsControl::offset)
|
||||||
arg("abs")=false,
|
.def_readwrite("wheel_radius", &cr::WheelPhysicsControl::wheel_radius)
|
||||||
arg("traction_control")=false,
|
.def_readwrite("wheel_width", &cr::WheelPhysicsControl::wheel_width)
|
||||||
arg("max_brake_torque")=1500.0f,
|
.def_readwrite("wheel_mass", &cr::WheelPhysicsControl::wheel_mass)
|
||||||
arg("max_handbrake_torque")=3000.0f,
|
|
||||||
arg("position")=cg::Vector3D{0.0f, 0.0f, 0.0f})))
|
|
||||||
.def_readwrite("tire_friction", &cr::WheelPhysicsControl::tire_friction)
|
|
||||||
.def_readwrite("max_steer_angle", &cr::WheelPhysicsControl::max_steer_angle)
|
|
||||||
.def_readwrite("radius", &cr::WheelPhysicsControl::radius)
|
|
||||||
.def_readwrite("cornering_stiffness", &cr::WheelPhysicsControl::cornering_stiffness)
|
.def_readwrite("cornering_stiffness", &cr::WheelPhysicsControl::cornering_stiffness)
|
||||||
.def_readwrite("abs", &cr::WheelPhysicsControl::abs)
|
.def_readwrite("friction_force_multiplier", &cr::WheelPhysicsControl::friction_force_multiplier)
|
||||||
.def_readwrite("traction_control", &cr::WheelPhysicsControl::traction_control)
|
.def_readwrite("side_slip_modifier", &cr::WheelPhysicsControl::side_slip_modifier)
|
||||||
|
.def_readwrite("slip_threshold", &cr::WheelPhysicsControl::slip_threshold)
|
||||||
|
.def_readwrite("skid_threshold", &cr::WheelPhysicsControl::skid_threshold)
|
||||||
|
.def_readwrite("max_steer_angle", &cr::WheelPhysicsControl::max_steer_angle)
|
||||||
|
.def_readwrite("affected_by_steering", &cr::WheelPhysicsControl::affected_by_steering)
|
||||||
|
.def_readwrite("affected_by_brake", &cr::WheelPhysicsControl::affected_by_brake)
|
||||||
|
.def_readwrite("affected_by_handbrake", &cr::WheelPhysicsControl::affected_by_handbrake)
|
||||||
|
.def_readwrite("affected_by_engine", &cr::WheelPhysicsControl::affected_by_engine)
|
||||||
|
.def_readwrite("abs_enabled", &cr::WheelPhysicsControl::abs_enabled)
|
||||||
|
.def_readwrite("traction_control_enabled", &cr::WheelPhysicsControl::traction_control_enabled)
|
||||||
|
.def_readwrite("max_wheelspin_rotation", &cr::WheelPhysicsControl::max_wheelspin_rotation)
|
||||||
|
.def_readwrite("external_torque_combine_method", &cr::WheelPhysicsControl::external_torque_combine_method)
|
||||||
|
.def_readwrite("lateral_slip_graph", &cr::WheelPhysicsControl::lateral_slip_graph)
|
||||||
|
.def_readwrite("suspension_axis", &cr::WheelPhysicsControl::suspension_axis)
|
||||||
|
.def_readwrite("suspension_force_offset", &cr::WheelPhysicsControl::suspension_force_offset)
|
||||||
|
.def_readwrite("suspension_max_raise", &cr::WheelPhysicsControl::suspension_max_raise)
|
||||||
|
.def_readwrite("suspension_max_drop", &cr::WheelPhysicsControl::suspension_max_drop)
|
||||||
|
.def_readwrite("suspension_damping_ratio", &cr::WheelPhysicsControl::suspension_damping_ratio)
|
||||||
|
.def_readwrite("wheel_load_ratio", &cr::WheelPhysicsControl::wheel_load_ratio)
|
||||||
|
.def_readwrite("spring_rate", &cr::WheelPhysicsControl::spring_rate)
|
||||||
|
.def_readwrite("spring_preload", &cr::WheelPhysicsControl::spring_preload)
|
||||||
|
.def_readwrite("suspension_smoothing", &cr::WheelPhysicsControl::suspension_smoothing)
|
||||||
|
.def_readwrite("rollbar_scaling", &cr::WheelPhysicsControl::rollbar_scaling)
|
||||||
|
.def_readwrite("sweep_shape", &cr::WheelPhysicsControl::sweep_shape)
|
||||||
|
.def_readwrite("sweep_type", &cr::WheelPhysicsControl::sweep_type)
|
||||||
.def_readwrite("max_brake_torque", &cr::WheelPhysicsControl::max_brake_torque)
|
.def_readwrite("max_brake_torque", &cr::WheelPhysicsControl::max_brake_torque)
|
||||||
.def_readwrite("max_handbrake_torque", &cr::WheelPhysicsControl::max_handbrake_torque)
|
.def_readwrite("max_hand_brake_torque", &cr::WheelPhysicsControl::max_hand_brake_torque)
|
||||||
.def_readwrite("position", &cr::WheelPhysicsControl::position)
|
.def_readwrite("wheel_index", &cr::WheelPhysicsControl::wheel_index)
|
||||||
|
.def_readwrite("location", &cr::WheelPhysicsControl::location)
|
||||||
|
.def_readwrite("old_location", &cr::WheelPhysicsControl::old_location)
|
||||||
|
.def_readwrite("velocity", &cr::WheelPhysicsControl::velocity)
|
||||||
.def("__eq__", &cr::WheelPhysicsControl::operator==)
|
.def("__eq__", &cr::WheelPhysicsControl::operator==)
|
||||||
.def("__ne__", &cr::WheelPhysicsControl::operator!=)
|
.def("__ne__", &cr::WheelPhysicsControl::operator!=)
|
||||||
.def(self_ns::str(self_ns::self))
|
.def(self_ns::str(self_ns::self))
|
||||||
|
|
|
@ -124,12 +124,12 @@ IMPLEMENT_MODULE(FCarlaModule, Carla)
|
||||||
// -- Implement carla throw_exception ------------------------------------------
|
// -- Implement carla throw_exception ------------------------------------------
|
||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
|
#ifndef __cpp_exceptions
|
||||||
#include <compiler/disable-ue4-macros.h>
|
#include <compiler/disable-ue4-macros.h>
|
||||||
#include <carla/Exception.h>
|
#include <carla/Exception.h>
|
||||||
#include <compiler/enable-ue4-macros.h>
|
#include <compiler/enable-ue4-macros.h>
|
||||||
|
|
||||||
#include <exception>
|
#include <exception>
|
||||||
|
|
||||||
namespace carla {
|
namespace carla {
|
||||||
|
|
||||||
void throw_exception(const std::exception &e) {
|
void throw_exception(const std::exception &e) {
|
||||||
|
@ -139,3 +139,4 @@ namespace carla {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace carla
|
} // namespace carla
|
||||||
|
#endif
|
||||||
|
|
|
@ -21,6 +21,7 @@ void FCarlaToolsModule::ShutdownModule()
|
||||||
|
|
||||||
IMPLEMENT_MODULE(FCarlaToolsModule, CarlaTools)
|
IMPLEMENT_MODULE(FCarlaToolsModule, CarlaTools)
|
||||||
|
|
||||||
|
#ifndef __cpp_exceptions
|
||||||
#include <compiler/disable-ue4-macros.h>
|
#include <compiler/disable-ue4-macros.h>
|
||||||
#include <carla/Exception.h>
|
#include <carla/Exception.h>
|
||||||
#include <compiler/enable-ue4-macros.h>
|
#include <compiler/enable-ue4-macros.h>
|
||||||
|
@ -36,3 +37,4 @@ namespace carla {
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace carla
|
} // namespace carla
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue