Removing is_steerable param and updating tests

This commit is contained in:
Manish 2019-05-22 16:15:33 +02:00
parent e2106e245d
commit f7b7ccd9d3
6 changed files with 13 additions and 23 deletions

View File

@ -235,8 +235,8 @@
- `tire_friction`
- `damping_rate`
- `max_steer_angle`
- `is_steerable`
- `radius`
- `position`
- `__eq__(other)`
- `__ne__(other)`

View File

@ -20,20 +20,17 @@ namespace rpc {
float in_tire_friction,
float in_damping_rate,
float in_max_steer_angle,
bool in_is_steerable,
float in_radius,
geom::Vector3D in_position)
: tire_friction(in_tire_friction),
damping_rate(in_damping_rate),
max_steer_angle(in_max_steer_angle),
is_steerable(in_is_steerable),
radius(in_radius),
position(in_position) {}
float tire_friction = 2.0f;
float damping_rate = 0.25f;
float max_steer_angle = 70.0f;
bool is_steerable = true;
float radius = 30.0f;
geom::Vector3D position = {0.0f, 0.0f, 0.0f};
@ -42,7 +39,6 @@ namespace rpc {
tire_friction != rhs.tire_friction ||
damping_rate != rhs.damping_rate ||
max_steer_angle != rhs.max_steer_angle ||
is_steerable != rhs.is_steerable ||
radius != rhs.radius ||
position != rhs.position;
}
@ -56,7 +52,6 @@ namespace rpc {
: tire_friction(Wheel.TireFriction),
damping_rate(Wheel.DampingRate),
max_steer_angle(Wheel.MaxSteerAngle),
is_steerable(Wheel.IsSteerable),
radius(Wheel.Radius),
position(Wheel.Position.X, Wheel.Position.Y, Wheel.Position.Z) {}
@ -65,7 +60,6 @@ namespace rpc {
Wheel.TireFriction = tire_friction;
Wheel.DampingRate = damping_rate;
Wheel.MaxSteerAngle = max_steer_angle;
Wheel.IsSteerable = is_steerable;
Wheel.Radius = radius;
Wheel.Position = {position.x, position.y, position.z};
return Wheel;
@ -75,7 +69,6 @@ namespace rpc {
MSGPACK_DEFINE_ARRAY(tire_friction,
damping_rate,
max_steer_angle,
is_steerable,
radius,
position)
};

View File

@ -40,8 +40,8 @@ namespace rpc {
out << "WheelPhysicsControl(tire_friction=" << control.tire_friction
<< ", damping_rate=" << control.damping_rate
<< ", max_steer_angle=" << control.max_steer_angle
<< ", is_steerable=" << boolalpha(control.is_steerable)
<< ", radius=" << control.radius << ')';
<< ", radius=" << control.radius
<< ", position=" << control.position << ')';
return out;
}
@ -207,17 +207,15 @@ void export_control() {
;
class_<cr::WheelPhysicsControl>("WheelPhysicsControl")
.def(init<float, float, float, bool, float, cg::Vector3D>(
.def(init<float, float, float, float, cg::Vector3D>(
(arg("tire_friction")=2.0f,
arg("damping_rate")=0.25f,
arg("max_steer_angle")=70.0f,
arg("is_steerable")=false,
arg("radius")=30.0f,
arg("position")=cg::Vector3D{0.0f, 0.0f, 0.0f})))
.def_readwrite("tire_friction", &cr::WheelPhysicsControl::tire_friction)
.def_readwrite("damping_rate", &cr::WheelPhysicsControl::damping_rate)
.def_readwrite("max_steer_angle", &cr::WheelPhysicsControl::max_steer_angle)
.def_readwrite("is_steerable", &cr::WheelPhysicsControl::is_steerable)
.def_readwrite("radius", &cr::WheelPhysicsControl::radius)
.def_readwrite("position", &cr::WheelPhysicsControl::position)
.def("__eq__", &cr::WheelPhysicsControl::operator==)

View File

@ -52,10 +52,10 @@ class TestVehiclePhysicsControl(unittest.TestCase):
carla.Vector2D(x=63.0868, y=0.703473),
carla.Vector2D(x=119.12, y=0.573047)]
wheels = [carla.WheelPhysicsControl(tire_friction=2, damping_rate=0, max_steer_angle=30, is_steerable=True),
carla.WheelPhysicsControl(tire_friction=2, damping_rate=0, max_steer_angle=30, is_steerable=True),
carla.WheelPhysicsControl(tire_friction=2, damping_rate=0, max_steer_angle=30, is_steerable=True),
carla.WheelPhysicsControl(tire_friction=2, damping_rate=0, max_steer_angle=30, is_steerable=True)]
wheels = [carla.WheelPhysicsControl(tire_friction=2, damping_rate=0, max_steer_angle=30, radius=10),
carla.WheelPhysicsControl(tire_friction=3, damping_rate=1, max_steer_angle=40, radius=20),
carla.WheelPhysicsControl(tire_friction=4, damping_rate=2, max_steer_angle=50, radius=30),
carla.WheelPhysicsControl(tire_friction=5, damping_rate=3, max_steer_angle=60, radius=40)]
pc = carla.VehiclePhysicsControl(
torque_curve=torque_curve,
@ -106,4 +106,8 @@ class TestVehiclePhysicsControl(unittest.TestCase):
self.assertTrue(abs(pc.wheels[i].tire_friction - wheels[i].tire_friction) <= error)
self.assertTrue(abs(pc.wheels[i].damping_rate - wheels[i].damping_rate) <= error)
self.assertTrue(abs(pc.wheels[i].max_steer_angle - wheels[i].max_steer_angle) <= error)
self.assertEqual(pc.wheels[i].is_steerable, wheels[i].is_steerable)
self.assertTrue(abs(pc.wheels[i].radius - wheels[i].radius) <= error)
self.assertTrue(abs(pc.wheels[i].position.x - wheels[i].position.x) <= error)
self.assertTrue(abs(pc.wheels[i].position.y - wheels[i].position.y) <= error)
self.assertTrue(abs(pc.wheels[i].position.z - wheels[i].position.z) <= error)

View File

@ -322,8 +322,6 @@ void ACarlaWheeledVehicle::ApplyVehiclePhysicsControl(const FVehiclePhysicsContr
{
FWheelSetup WheelSetup = Vehicle4W->WheelSetups[i];
WheelSetup.bDisableSteering = !PhysicsControl.Wheels[i].IsSteerable;
PxVehicleWheelData PWheelData = Vehicle4W->PVehicle->mWheelsSimData.getWheelData(i);
PWheelData.mRadius = PhysicsControl.Wheels[i].Radius;

View File

@ -22,9 +22,6 @@ struct CARLA_API FWheelPhysicsControl
UPROPERTY(Category = "Wheel Max Steer Angle", EditAnywhere, BlueprintReadWrite)
float MaxSteerAngle = 70.0f;
UPROPERTY(Category = "Wheel Is Steerable", EditAnywhere, BlueprintReadWrite)
bool IsSteerable = true;
UPROPERTY(Category = "Wheel Shape Radius", EditAnywhere, BlueprintReadWrite)
float Radius = 30.0f;