Adding Differential Type as int
This commit is contained in:
parent
fd95933ce2
commit
41a5ebcf1c
|
@ -3048,6 +3048,8 @@ The maximum RPM of the vehicle's engine.
|
|||
The moment of inertia of the vehicle's engine.
|
||||
- <a name="carla.VehiclePhysicsControl.rev_down_rate"></a>**<font color="#f8805a">rev_down_rate</font>** (_float_)
|
||||
Affects how fast the vehicle's engine RPM slows down.
|
||||
- <a name="carla.VehiclePhysicsControl.differential_type"></a>**<font color="#f8805a">differential_type</font>** (int)
|
||||
Type of differential (Undefined = 0, AllWheelDrive = 1, FrontWheelDrive = 2, RearWheelDrive = 3).
|
||||
- <a name="carla.VehiclePhysicsControl.front_rear_split"></a>**<font color="#f8805a">front_rear_split</font>** (_float_)
|
||||
Ratio of torque split between front and rear (<0.5 means more to front, >0.5 means more to rear, works only with 4W type).
|
||||
- <a name="carla.VehiclePhysicsControl.use_gear_autobox"></a>**<font color="#f8805a">use_gear_autobox</font>** (_bool_)
|
||||
|
@ -3080,7 +3082,7 @@ Enable the use of sweep for wheel collision. By default, it is disabled and it u
|
|||
List of wheel physics objects. This list should have 4 elements, where index 0 corresponds to the front left wheel, index 1 corresponds to the front right wheel, index 2 corresponds to the back left wheel and index 3 corresponds to the back right wheel. For 2 wheeled vehicles, set the same values for both front and back wheels.
|
||||
|
||||
### Methods
|
||||
- <a name="carla.VehiclePhysicsControl.__init__"></a>**<font color="#7fb800">\__init__</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**torque_curve**=[[0.0, 500.0], [5000.0, 500.0]]</font>, <font color="#00a6ed">**max_torque**=300.0</font>, <font color="#00a6ed">**max_rpm**=5000.0</font>, <font color="#00a6ed">**moi**=1.0</font>, <font color="#00a6ed">**rev_down_rate**=600.0</font>, <font color="#00a6ed">**front_rear_split**=0.5</font>, <font color="#00a6ed">**use_gear_autobox**=True</font>, <font color="#00a6ed">**gear_switch_time**=0.5</font>, <font color="#00a6ed">**final_ratio**=4.0</font>, <font color="#00a6ed">**forward_gears**=[2.85, 2.02, 1.35, 1.0, 2.85, 2.02, 1.35, 1.0]</font>, <font color="#00a6ed">**reverse_gears**=[2.86, 2.86]</font>, <font color="#00a6ed">**change_up_rpm**=4500.0</font>, <font color="#00a6ed">**change_down_rpm**=2000.0</font>, <font color="#00a6ed">**transmission_efficiency**=0.9</font>, <font color="#00a6ed">**mass**=1000.0</font>, <font color="#00a6ed">**drag_coefficient**=0.3</font>, <font color="#00a6ed">**center_of_mass**=[0.0, 0.0, 0.0]</font>, <font color="#00a6ed">**steering_curve**=[[0.0, 1.0], [10.0, 0.5]]</font>, <font color="#00a6ed">**wheels**=list()</font>, <font color="#00a6ed">**use_sweep_wheel_collision**=False</font>)
|
||||
- <a name="carla.VehiclePhysicsControl.__init__"></a>**<font color="#7fb800">\__init__</font>**(<font color="#00a6ed">**self**</font>, <font color="#00a6ed">**torque_curve**=[[0.0, 500.0], [5000.0, 500.0]]</font>, <font color="#00a6ed">**max_torque**=300.0</font>, <font color="#00a6ed">**max_rpm**=5000.0</font>, <font color="#00a6ed">**moi**=1.0</font>, <font color="#00a6ed">**rev_down_rate**=600.0</font>, <font color="#00a6ed">**differential_type**=3</font>, <font color="#00a6ed">**front_rear_split**=0.5</font>, <font color="#00a6ed">**use_gear_autobox**=True</font>, <font color="#00a6ed">**gear_switch_time**=0.5</font>, <font color="#00a6ed">**final_ratio**=4.0</font>, <font color="#00a6ed">**forward_gears**=[2.85, 2.02, 1.35, 1.0, 2.85, 2.02, 1.35, 1.0]</font>, <font color="#00a6ed">**reverse_gears**=[2.86, 2.86]</font>, <font color="#00a6ed">**change_up_rpm**=4500.0</font>, <font color="#00a6ed">**change_down_rpm**=2000.0</font>, <font color="#00a6ed">**transmission_efficiency**=0.9</font>, <font color="#00a6ed">**mass**=1000.0</font>, <font color="#00a6ed">**drag_coefficient**=0.3</font>, <font color="#00a6ed">**center_of_mass**=[0.0, 0.0, 0.0]</font>, <font color="#00a6ed">**steering_curve**=[[0.0, 1.0], [10.0, 0.5]]</font>, <font color="#00a6ed">**wheels**=list()</font>, <font color="#00a6ed">**use_sweep_wheel_collision**=False</font>)
|
||||
VehiclePhysicsControl constructor.
|
||||
- **Parameters:**
|
||||
- `torque_curve` (_list([carla.Vector2D](#carla.Vector2D))_)
|
||||
|
@ -3088,6 +3090,7 @@ VehiclePhysicsControl constructor.
|
|||
- `max_rpm` (_float_)
|
||||
- `moi` (_float<small> - kg*m<sup>2</sup></small>_)
|
||||
- `rev_down_rate` (_float_)
|
||||
- `differential_type` (_int_)
|
||||
- `front_rear_split` (_float_)
|
||||
- `use_gear_autobox` (_bool_)
|
||||
- `gear_switch_time` (_float<small> - seconds</small>_)
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace rpc {
|
|||
float in_moi,
|
||||
float in_rev_down_rate,
|
||||
|
||||
uint8_t in_differential_type,
|
||||
float in_front_rear_split,
|
||||
|
||||
bool in_use_gear_autobox,
|
||||
|
@ -51,6 +52,7 @@ namespace rpc {
|
|||
max_rpm(in_max_rpm),
|
||||
moi(in_moi),
|
||||
rev_down_rate(in_rev_down_rate),
|
||||
differential_type(in_differential_type),
|
||||
front_rear_split(in_front_rear_split),
|
||||
use_gear_autobox(in_use_gear_autobox),
|
||||
gear_switch_time(in_gear_switch_time),
|
||||
|
@ -121,6 +123,8 @@ namespace rpc {
|
|||
float moi = 1.0f;
|
||||
float rev_down_rate = 600.0f;
|
||||
|
||||
// ToDo: Convert to an enum, see EVehicleDifferential.
|
||||
uint8_t differential_type = 0;
|
||||
float front_rear_split = 0.5f;
|
||||
|
||||
bool use_gear_autobox = true;
|
||||
|
@ -148,6 +152,7 @@ namespace rpc {
|
|||
moi != rhs.moi ||
|
||||
rev_down_rate != rhs.rev_down_rate ||
|
||||
|
||||
differential_type != rhs.differential_type ||
|
||||
front_rear_split != rhs.front_rear_split ||
|
||||
|
||||
use_gear_autobox != rhs.use_gear_autobox ||
|
||||
|
@ -187,6 +192,7 @@ namespace rpc {
|
|||
rev_down_rate = Control.RevDownRate;
|
||||
|
||||
// Differential Setup
|
||||
differential_type = Control.DifferentialType;
|
||||
front_rear_split = Control.FrontRearSplit;
|
||||
|
||||
// Transmission Setup
|
||||
|
@ -244,6 +250,7 @@ namespace rpc {
|
|||
Control.RevDownRate = rev_down_rate;
|
||||
|
||||
// Differential Setup
|
||||
Control.DifferentialType = differential_type;
|
||||
Control.FrontRearSplit = front_rear_split;
|
||||
|
||||
// Transmission Setup
|
||||
|
@ -299,6 +306,7 @@ namespace rpc {
|
|||
max_rpm,
|
||||
moi,
|
||||
rev_down_rate,
|
||||
differential_type,
|
||||
front_rear_split,
|
||||
use_gear_autobox,
|
||||
gear_switch_time,
|
||||
|
|
|
@ -481,6 +481,7 @@ namespace rpc {
|
|||
<< ", max_rpm=" << std::to_string(control.max_rpm)
|
||||
<< ", moi=" << std::to_string(control.moi)
|
||||
<< ", rev_down_rate=" << std::to_string(control.rev_down_rate)
|
||||
<< ", differential_type=" << std::to_string(control.differential_type)
|
||||
<< ", front_rear_split=" << std::to_string(control.front_rear_split)
|
||||
<< ", use_gear_autobox=" << boolalpha(control.use_gear_autobox)
|
||||
<< ", gear_switch_time=" << std::to_string(control.gear_switch_time)
|
||||
|
|
|
@ -117,7 +117,7 @@ static void SetSteeringCurve(carla::rpc::VehiclePhysicsControl &self, const boos
|
|||
|
||||
boost::python::object VehiclePhysicsControl_init(boost::python::tuple args, boost::python::dict kwargs) {
|
||||
// Args names
|
||||
const uint32_t NUM_ARGUMENTS = 20;
|
||||
const uint32_t NUM_ARGUMENTS = 21;
|
||||
const char *args_names[NUM_ARGUMENTS] = {
|
||||
"torque_curve",
|
||||
"max_torque",
|
||||
|
@ -125,6 +125,7 @@ boost::python::object VehiclePhysicsControl_init(boost::python::tuple args, boos
|
|||
"moi",
|
||||
"rev_down_rate",
|
||||
|
||||
"differential_type",
|
||||
"front_rear_split",
|
||||
|
||||
"use_gear_autobox",
|
||||
|
@ -368,6 +369,7 @@ void export_control() {
|
|||
.def_readwrite("max_rpm", &cr::VehiclePhysicsControl::max_rpm)
|
||||
.def_readwrite("moi", &cr::VehiclePhysicsControl::moi)
|
||||
.def_readwrite("rev_down_rate", &cr::VehiclePhysicsControl::rev_down_rate)
|
||||
.def_readwrite("differential_type", &cr::VehiclePhysicsControl::differential_type)
|
||||
.def_readwrite("front_rear_split", &cr::VehiclePhysicsControl::front_rear_split)
|
||||
.def_readwrite("use_gear_autobox", &cr::VehiclePhysicsControl::use_gear_autobox)
|
||||
.def_readwrite("gear_switch_time", &cr::VehiclePhysicsControl::gear_switch_time)
|
||||
|
|
|
@ -352,6 +352,11 @@
|
|||
doc: >
|
||||
Affects how fast the vehicle's engine RPM slows down.
|
||||
# --------------------------------------
|
||||
- var_name: differential_type
|
||||
type: int
|
||||
doc: >
|
||||
Type of differential (Undefined = 0, AllWheelDrive = 1, FrontWheelDrive = 2, RearWheelDrive = 3).
|
||||
# --------------------------------------
|
||||
- var_name: front_rear_split
|
||||
type: float
|
||||
doc: >
|
||||
|
@ -453,6 +458,9 @@
|
|||
- param_name: rev_down_rate
|
||||
default: 600.0
|
||||
type: float
|
||||
- param_name: differential_type
|
||||
default: 3
|
||||
type: int
|
||||
- param_name: front_rear_split
|
||||
default: 0.5
|
||||
type: float
|
||||
|
|
|
@ -21,6 +21,7 @@ void CarlaRecorderPhysicsControl::Write(std::ostream &OutFile)
|
|||
WriteValue(OutFile, RPCPhysicsControl.max_rpm);
|
||||
WriteValue(OutFile, RPCPhysicsControl.moi);
|
||||
WriteValue(OutFile, RPCPhysicsControl.rev_down_rate);
|
||||
WriteValue(OutFile, RPCPhysicsControl.differential_type);
|
||||
WriteValue(OutFile, RPCPhysicsControl.front_rear_split);
|
||||
WriteValue(OutFile, RPCPhysicsControl.use_gear_autobox);
|
||||
WriteValue(OutFile, RPCPhysicsControl.final_ratio);
|
||||
|
@ -55,6 +56,7 @@ void CarlaRecorderPhysicsControl::Read(std::istream &InFile)
|
|||
ReadValue(InFile, RPCPhysicsControl.max_rpm);
|
||||
ReadValue(InFile, RPCPhysicsControl.moi);
|
||||
ReadValue(InFile, RPCPhysicsControl.rev_down_rate);
|
||||
ReadValue(InFile, RPCPhysicsControl.differential_type);
|
||||
ReadValue(InFile, RPCPhysicsControl.front_rear_split);
|
||||
ReadValue(InFile, RPCPhysicsControl.use_gear_autobox);
|
||||
ReadValue(InFile, RPCPhysicsControl.final_ratio);
|
||||
|
|
|
@ -516,6 +516,7 @@ std::string CarlaRecorderQuery::QueryInfo(std::string Filename, bool bShowAll)
|
|||
<< " max_rpm = " << Control.max_rpm << std::endl
|
||||
<< " MOI = " << Control.moi << std::endl
|
||||
<< " rev_down_rate = " << Control.rev_down_rate << std::endl
|
||||
<< " differential_type = " << Control.differential_type << std::endl
|
||||
<< " front_rear_split = " << Control.front_rear_split << std::endl
|
||||
<< " use_gear_auto_box = " << (Control.use_gear_autobox ? "true" : "false") << std::endl
|
||||
<< " gear_switch_time = " << Control.gear_switch_time << std::endl
|
||||
|
|
|
@ -371,6 +371,7 @@ FVehiclePhysicsControl ACarlaWheeledVehicle::GetVehiclePhysicsControl() const
|
|||
PhysicsControl.RevDownRate = VehicleMovComponent->EngineSetup.EngineRevDownRate;
|
||||
|
||||
// Differential Setup
|
||||
PhysicsControl.DifferentialType = static_cast<uint8>(VehicleMovComponent->DifferentialSetup.DifferentialType);
|
||||
PhysicsControl.FrontRearSplit = VehicleMovComponent->DifferentialSetup.FrontRearSplit;
|
||||
|
||||
// Transmission Setup
|
||||
|
@ -451,6 +452,7 @@ void ACarlaWheeledVehicle::ApplyVehiclePhysicsControl(const FVehiclePhysicsContr
|
|||
VehicleMovComponent->EngineSetup.EngineRevDownRate = PhysicsControl.RevDownRate;
|
||||
|
||||
// Differential Setup
|
||||
VehicleMovComponent->DifferentialSetup.DifferentialType = static_cast<EVehicleDifferential>(PhysicsControl.DifferentialType);
|
||||
VehicleMovComponent->DifferentialSetup.FrontRearSplit = PhysicsControl.FrontRearSplit;
|
||||
|
||||
// Transmission Setup
|
||||
|
|
|
@ -35,6 +35,10 @@ struct CARLA_API FVehiclePhysicsControl
|
|||
float RevDownRate = 600.0f;
|
||||
|
||||
// Differential Setup
|
||||
// ToDo: Convert to an enum, see EVehicleDifferential.
|
||||
UPROPERTY(Category = "Vehicle Engine Physics Control", EditAnywhere, BlueprintReadWrite)
|
||||
uint8 DifferentialType = 0;
|
||||
|
||||
UPROPERTY(Category = "Vehicle Engine Physics Control", EditAnywhere, BlueprintReadWrite)
|
||||
float FrontRearSplit = 0.5f;
|
||||
|
||||
|
|
Loading…
Reference in New Issue