Fix warnings.
This commit is contained in:
@@ -74,20 +74,24 @@ impl BallJoint {
|
||||
self.motor_max_impulse == 0.0 || (self.motor_stiffness == 0.0 && self.motor_damping == 0.0)
|
||||
}
|
||||
|
||||
/// Set the spring-like model used by the motor to reach the desired target velocity and position.
|
||||
pub fn configure_motor_model(&mut self, model: SpringModel) {
|
||||
self.motor_model = model;
|
||||
}
|
||||
|
||||
/// Sets the target velocity and velocity correction factor this motor.
|
||||
#[cfg(feature = "dim2")]
|
||||
pub fn configure_motor_velocity(&mut self, target_vel: Real, factor: Real) {
|
||||
self.configure_motor(self.motor_target_pos, target_vel, 0.0, factor)
|
||||
}
|
||||
|
||||
/// Sets the target velocity and velocity correction factor this motor.
|
||||
#[cfg(feature = "dim3")]
|
||||
pub fn configure_motor_velocity(&mut self, target_vel: Vector<Real>, factor: Real) {
|
||||
self.configure_motor(self.motor_target_pos, target_vel, 0.0, factor)
|
||||
}
|
||||
|
||||
/// Sets the target orientation this motor needs to reach.
|
||||
pub fn configure_motor_position(
|
||||
&mut self,
|
||||
target_pos: Rotation<Real>,
|
||||
@@ -97,6 +101,7 @@ impl BallJoint {
|
||||
self.configure_motor(target_pos, na::zero(), stiffness, damping)
|
||||
}
|
||||
|
||||
/// Sets the target orientation this motor needs to reach.
|
||||
#[cfg(feature = "dim2")]
|
||||
pub fn configure_motor(
|
||||
&mut self,
|
||||
@@ -111,6 +116,7 @@ impl BallJoint {
|
||||
self.motor_damping = damping;
|
||||
}
|
||||
|
||||
/// Configure both the target orientation and target velocity of the motor.
|
||||
#[cfg(feature = "dim3")]
|
||||
pub fn configure_motor(
|
||||
&mut self,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::dynamics::{BallJoint, FixedJoint, PrismaticJoint, RevoluteJoint};
|
||||
use crate::math::{Isometry, Real, SpacialVector, SPATIAL_DIM};
|
||||
use crate::math::{Isometry, Real, SpacialVector};
|
||||
use crate::na::{Rotation3, UnitQuaternion};
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
|
||||
@@ -130,6 +130,7 @@ pub struct Joint {
|
||||
}
|
||||
|
||||
impl Joint {
|
||||
/// Can this joint use SIMD-accelerated constraint formulations?
|
||||
pub fn supports_simd_constraints(&self) -> bool {
|
||||
match &self.params {
|
||||
JointParams::PrismaticJoint(joint) => joint.supports_simd_constraints(),
|
||||
|
||||
@@ -217,18 +217,22 @@ impl PrismaticJoint {
|
||||
Isometry::from_parts(translation, rotation)
|
||||
}
|
||||
|
||||
/// Set the spring-like model used by the motor to reach the desired target velocity and position.
|
||||
pub fn configure_motor_model(&mut self, model: SpringModel) {
|
||||
self.motor_model = model;
|
||||
}
|
||||
|
||||
/// Sets the target velocity this motor needs to reach.
|
||||
pub fn configure_motor_velocity(&mut self, target_vel: Real, factor: Real) {
|
||||
self.configure_motor(self.motor_target_pos, target_vel, 0.0, factor)
|
||||
}
|
||||
|
||||
/// Sets the target position this motor needs to reach.
|
||||
pub fn configure_motor_position(&mut self, target_pos: Real, stiffness: Real, damping: Real) {
|
||||
self.configure_motor(target_pos, 0.0, stiffness, damping)
|
||||
}
|
||||
|
||||
/// Configure both the target position and target velocity of the motor.
|
||||
pub fn configure_motor(
|
||||
&mut self,
|
||||
target_pos: Real,
|
||||
|
||||
@@ -85,18 +85,22 @@ impl RevoluteJoint {
|
||||
self.motor_max_impulse == 0.0 || (self.motor_stiffness == 0.0 && self.motor_damping == 0.0)
|
||||
}
|
||||
|
||||
/// Set the spring-like model used by the motor to reach the desired target velocity and position.
|
||||
pub fn configure_motor_model(&mut self, model: SpringModel) {
|
||||
self.motor_model = model;
|
||||
}
|
||||
|
||||
/// Sets the target velocity this motor needs to reach.
|
||||
pub fn configure_motor_velocity(&mut self, target_vel: Real, factor: Real) {
|
||||
self.configure_motor(self.motor_target_pos, target_vel, 0.0, factor)
|
||||
}
|
||||
|
||||
/// Sets the target angle this motor needs to reach.
|
||||
pub fn configure_motor_position(&mut self, target_pos: Real, stiffness: Real, damping: Real) {
|
||||
self.configure_motor(target_pos, 0.0, stiffness, damping)
|
||||
}
|
||||
|
||||
/// Configure both the target angle and target velocity of the motor.
|
||||
pub fn configure_motor(
|
||||
&mut self,
|
||||
target_pos: Real,
|
||||
|
||||
@@ -210,7 +210,8 @@ impl BallVelocityConstraint {
|
||||
let new_impulse = self.motor_impulse + motor_inv_lhs.transform_vector(dangvel);
|
||||
|
||||
#[cfg(feature = "dim2")]
|
||||
let clamped_impulse = na::clamp(new_impulse, -motor_max_impulse, motor_max_impulse);
|
||||
let clamped_impulse =
|
||||
na::clamp(new_impulse, -self.motor_max_impulse, self.motor_max_impulse);
|
||||
#[cfg(feature = "dim3")]
|
||||
let clamped_impulse = new_impulse.cap_magnitude(self.motor_max_impulse);
|
||||
|
||||
@@ -418,7 +419,8 @@ impl BallVelocityGroundConstraint {
|
||||
let new_impulse = self.motor_impulse + motor_inv_lhs.transform_vector(dangvel);
|
||||
|
||||
#[cfg(feature = "dim2")]
|
||||
let clamped_impulse = na::clamp(new_impulse, -motor_max_impulse, motor_max_impulse);
|
||||
let clamped_impulse =
|
||||
na::clamp(new_impulse, -self.motor_max_impulse, self.motor_max_impulse);
|
||||
#[cfg(feature = "dim3")]
|
||||
let clamped_impulse = new_impulse.cap_magnitude(self.motor_max_impulse);
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ use super::{
|
||||
WFixedPositionGroundConstraint, WPrismaticPositionConstraint,
|
||||
WPrismaticPositionGroundConstraint,
|
||||
};
|
||||
use crate::dynamics::solver::DeltaVel;
|
||||
use crate::dynamics::{IntegrationParameters, Joint, JointParams, RigidBodySet};
|
||||
#[cfg(feature = "simd-is-enabled")]
|
||||
use crate::math::SIMD_WIDTH;
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::dynamics::{
|
||||
IntegrationParameters, JointGraphEdge, JointIndex, JointParams, PrismaticJoint, RigidBody,
|
||||
};
|
||||
use crate::math::{AngularInertia, Real, Vector};
|
||||
use crate::utils::{WAngularInertia, WCross, WCrossMatrix};
|
||||
use crate::utils::{WAngularInertia, WCross, WCrossMatrix, WDot};
|
||||
#[cfg(feature = "dim3")]
|
||||
use na::{Cholesky, Matrix3x2, Matrix5, Vector5, U2, U3};
|
||||
#[cfg(feature = "dim2")]
|
||||
@@ -148,7 +148,6 @@ impl PrismaticVelocityConstraint {
|
||||
*/
|
||||
let mut motor_rhs = 0.0;
|
||||
let mut motor_inv_lhs = 0.0;
|
||||
let mut motor_max_impulse = joint.motor_max_impulse;
|
||||
|
||||
let (stiffness, damping, gamma, keep_lhs) = joint.motor_model.combine_coefficients(
|
||||
params.dt,
|
||||
@@ -171,7 +170,11 @@ impl PrismaticVelocityConstraint {
|
||||
motor_rhs /= gamma;
|
||||
}
|
||||
|
||||
let motor_impulse = na::clamp(joint.motor_impulse, -motor_max_impulse, motor_max_impulse);
|
||||
let motor_impulse = na::clamp(
|
||||
joint.motor_impulse,
|
||||
-joint.motor_max_impulse,
|
||||
joint.motor_max_impulse,
|
||||
);
|
||||
|
||||
/*
|
||||
* Setup limit constraint.
|
||||
@@ -202,8 +205,8 @@ impl PrismaticVelocityConstraint {
|
||||
let gcross2 = r2.gcross(*axis2);
|
||||
limits_inv_lhs = crate::utils::inv(
|
||||
im1 + im2
|
||||
+ gcross1.dot(&ii1.transform_vector(gcross1))
|
||||
+ gcross2.dot(&ii2.transform_vector(gcross2)),
|
||||
+ gcross1.gdot(ii1.transform_vector(gcross1))
|
||||
+ gcross2.gdot(ii2.transform_vector(gcross2)),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -226,7 +229,7 @@ impl PrismaticVelocityConstraint {
|
||||
motor_impulse,
|
||||
motor_axis1: *axis1,
|
||||
motor_axis2: *axis2,
|
||||
motor_max_impulse,
|
||||
motor_max_impulse: joint.motor_max_impulse,
|
||||
basis1,
|
||||
inv_lhs,
|
||||
rhs,
|
||||
@@ -530,7 +533,6 @@ impl PrismaticVelocityGroundConstraint {
|
||||
*/
|
||||
let mut motor_rhs = 0.0;
|
||||
let mut motor_inv_lhs = 0.0;
|
||||
let mut motor_max_impulse = joint.motor_max_impulse;
|
||||
|
||||
let (stiffness, damping, gamma, keep_lhs) = joint.motor_model.combine_coefficients(
|
||||
params.dt,
|
||||
@@ -553,7 +555,11 @@ impl PrismaticVelocityGroundConstraint {
|
||||
motor_rhs /= gamma;
|
||||
}
|
||||
|
||||
let motor_impulse = na::clamp(joint.motor_impulse, -motor_max_impulse, motor_max_impulse);
|
||||
let motor_impulse = na::clamp(
|
||||
joint.motor_impulse,
|
||||
-joint.motor_max_impulse,
|
||||
joint.motor_max_impulse,
|
||||
);
|
||||
|
||||
/*
|
||||
* Setup limit constraint.
|
||||
@@ -590,7 +596,7 @@ impl PrismaticVelocityGroundConstraint {
|
||||
motor_rhs,
|
||||
motor_inv_lhs,
|
||||
motor_impulse,
|
||||
motor_max_impulse,
|
||||
motor_max_impulse: joint.motor_max_impulse,
|
||||
basis1,
|
||||
inv_lhs,
|
||||
rhs,
|
||||
|
||||
@@ -7,7 +7,7 @@ use crate::dynamics::{
|
||||
use crate::math::{
|
||||
AngVector, AngularInertia, Isometry, Point, Real, SimdBool, SimdReal, Vector, SIMD_WIDTH,
|
||||
};
|
||||
use crate::utils::{WAngularInertia, WCross, WCrossMatrix};
|
||||
use crate::utils::{WAngularInertia, WCross, WCrossMatrix, WDot};
|
||||
#[cfg(feature = "dim3")]
|
||||
use na::{Cholesky, Matrix3x2, Matrix5, Vector5, U2, U3};
|
||||
#[cfg(feature = "dim2")]
|
||||
@@ -223,8 +223,8 @@ impl WPrismaticVelocityConstraint {
|
||||
limits_inv_lhs = SimdReal::splat(1.0)
|
||||
/ (im1
|
||||
+ im2
|
||||
+ gcross1.dot(&ii1.transform_vector(gcross1))
|
||||
+ gcross2.dot(&ii2.transform_vector(gcross2)));
|
||||
+ gcross1.gdot(ii1.transform_vector(gcross1))
|
||||
+ gcross2.gdot(ii2.transform_vector(gcross2)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::dynamics::{IntegrationParameters, RevoluteJoint, RigidBody};
|
||||
use crate::math::{AngularInertia, Isometry, Point, Real, Rotation, Vector};
|
||||
use crate::utils::{WAngularInertia, WCross, WCrossMatrix};
|
||||
use na::{Matrix3x2, Matrix5, Unit};
|
||||
use na::Unit;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct RevolutePositionConstraint {
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
use crate::dynamics::solver::{AnyJointVelocityConstraint, AnyVelocityConstraint, DeltaVel};
|
||||
use crate::dynamics::solver::{AnyJointVelocityConstraint, DeltaVel};
|
||||
use crate::dynamics::{
|
||||
IntegrationParameters, JointGraphEdge, JointIndex, JointParams, RevoluteJoint, RigidBody,
|
||||
};
|
||||
use crate::math::{AngularInertia, Real, Rotation, Vector};
|
||||
use crate::na::UnitQuaternion;
|
||||
use crate::utils::{WAngularInertia, WCross, WCrossMatrix};
|
||||
use downcast_rs::Downcast;
|
||||
use na::{Cholesky, Matrix3, Matrix3x2, Matrix5, RealField, Vector5, U2, U3};
|
||||
use na::{Cholesky, Matrix3x2, Matrix5, Vector5, U2, U3};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct RevoluteVelocityConstraint {
|
||||
@@ -93,7 +92,7 @@ impl RevoluteVelocityConstraint {
|
||||
|
||||
let lin_rhs = (rb2.linvel + rb2.angvel.gcross(r2)) - (rb1.linvel + rb1.angvel.gcross(r1));
|
||||
let ang_rhs = basis2.tr_mul(&rb2.angvel) - basis1.tr_mul(&rb1.angvel);
|
||||
let mut rhs = Vector5::new(lin_rhs.x, lin_rhs.y, lin_rhs.z, ang_rhs.x, ang_rhs.y);
|
||||
let rhs = Vector5::new(lin_rhs.x, lin_rhs.y, lin_rhs.z, ang_rhs.x, ang_rhs.y);
|
||||
|
||||
/*
|
||||
* Motor.
|
||||
@@ -102,8 +101,8 @@ impl RevoluteVelocityConstraint {
|
||||
let motor_axis2 = rb2.position * *joint.local_axis2;
|
||||
let mut motor_rhs = 0.0;
|
||||
let mut motor_inv_lhs = 0.0;
|
||||
let mut motor_max_impulse = joint.motor_max_impulse;
|
||||
let mut motor_angle = 0.0;
|
||||
let motor_max_impulse = joint.motor_max_impulse;
|
||||
|
||||
let (stiffness, damping, gamma, keep_lhs) = joint.motor_model.combine_coefficients(
|
||||
params.dt,
|
||||
@@ -381,8 +380,8 @@ impl RevoluteVelocityGroundConstraint {
|
||||
*/
|
||||
let mut motor_rhs = 0.0;
|
||||
let mut motor_inv_lhs = 0.0;
|
||||
let mut motor_max_impulse = joint.motor_max_impulse;
|
||||
let mut motor_angle = 0.0;
|
||||
let motor_max_impulse = joint.motor_max_impulse;
|
||||
|
||||
let (stiffness, damping, gamma, keep_lhs) = joint.motor_model.combine_coefficients(
|
||||
params.dt,
|
||||
|
||||
@@ -8,7 +8,7 @@ use crate::math::{
|
||||
AngVector, AngularInertia, Isometry, Point, Real, Rotation, SimdReal, Vector, SIMD_WIDTH,
|
||||
};
|
||||
use crate::utils::{WAngularInertia, WCross, WCrossMatrix};
|
||||
use na::{Cholesky, Matrix3, Matrix3x2, Matrix5, Vector5, U2, U3};
|
||||
use na::{Cholesky, Matrix3x2, Matrix5, Vector5, U2, U3};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct WRevoluteVelocityConstraint {
|
||||
|
||||
@@ -148,10 +148,4 @@ pub mod math {
|
||||
/// single contact constraint.
|
||||
#[cfg(feature = "dim3")]
|
||||
pub const MAX_MANIFOLD_POINTS: usize = 4;
|
||||
|
||||
#[cfg(feature = "dim2")]
|
||||
pub const SPATIAL_DIM: usize = 3;
|
||||
|
||||
#[cfg(feature = "dim3")]
|
||||
pub const SPATIAL_DIM: usize = 6;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user