Skip to content

Commit

Permalink
Merge pull request microsoft#2537 from madratman/PR/fast_physics_bug_fix
Browse files Browse the repository at this point in the history
Bug fixes in drag face coordinates; computation of rotor torque from pwm
  • Loading branch information
madratman authored Apr 14, 2020
2 parents 740d4a2 + 461bc00 commit 64389ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions AirLib/include/vehicles/multirotor/MultiRotorPhysicsBody.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,12 @@ class MultiRotorPhysicsBody : public PhysicsBody {

//add six drag vertices representing 6 sides
drag_faces_.clear();
drag_faces_.emplace_back(Vector3r(0, 0, -params.body_box.z()), Vector3r(0, 0, -1), drag_factor_unit.z());
drag_faces_.emplace_back(Vector3r(0, 0, params.body_box.z()), Vector3r(0, 0, 1), drag_factor_unit.z());
drag_faces_.emplace_back(Vector3r(0, -params.body_box.y(), 0), Vector3r(0, -1, 0), drag_factor_unit.y());
drag_faces_.emplace_back(Vector3r(0, params.body_box.y(), 0), Vector3r(0, 1, 0), drag_factor_unit.y());
drag_faces_.emplace_back(Vector3r(-params.body_box.x(), 0, 0), Vector3r(-1, 0, 0), drag_factor_unit.x());
drag_faces_.emplace_back(Vector3r( params.body_box.x(), 0, 0), Vector3r( 1, 0, 0), drag_factor_unit.x());
drag_faces_.emplace_back(Vector3r(0, 0, -params.body_box.z() / 2.0f), Vector3r(0, 0, -1), drag_factor_unit.z());
drag_faces_.emplace_back(Vector3r(0, 0, params.body_box.z() / 2.0f), Vector3r(0, 0, 1), drag_factor_unit.z());
drag_faces_.emplace_back(Vector3r(0, -params.body_box.y() / 2.0f, 0), Vector3r(0, -1, 0), drag_factor_unit.y());
drag_faces_.emplace_back(Vector3r(0, params.body_box.y() / 2.0f, 0), Vector3r(0, 1, 0), drag_factor_unit.y());
drag_faces_.emplace_back(Vector3r(-params.body_box.x() / 2.0f, 0, 0), Vector3r(-1, 0, 0), drag_factor_unit.x());
drag_faces_.emplace_back(Vector3r( params.body_box.x() / 2.0f, 0, 0), Vector3r( 1, 0, 0), drag_factor_unit.x());

}

Expand Down
2 changes: 1 addition & 1 deletion AirLib/include/vehicles/multirotor/RotorActuator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class RotorActuator : public PhysicsBodyVertex {
//see relationship of rotation speed with thrust: http://physics.stackexchange.com/a/32013/14061
output.speed = sqrt(output.control_signal_filtered * params.max_speed_square);
output.thrust = output.control_signal_filtered * params.max_thrust;
output.torque_scaler = output.control_signal_input * params.max_torque * static_cast<int>(turning_direction);
output.torque_scaler = output.control_signal_filtered * params.max_torque * static_cast<int>(turning_direction);
output.turning_direction = turning_direction;
}

Expand Down

0 comments on commit 64389ad

Please sign in to comment.