1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use crate::solver::ImpulseLimits;
use na::RealField;
use num::Zero;
#[derive(Copy, Clone, Debug)]
pub struct JointMotor<V, N: RealField> {
pub desired_velocity: V,
pub max_velocity: N,
pub max_force: N,
pub enabled: bool,
}
impl<V: Zero, N: RealField> JointMotor<V, N> {
pub fn new() -> Self {
JointMotor {
desired_velocity: V::zero(),
max_velocity: N::max_value(),
max_force: N::max_value(),
enabled: false,
}
}
pub fn impulse_limits(&self) -> ImpulseLimits<N> {
ImpulseLimits::Independent {
min: -self.max_force,
max: self.max_force,
}
}
}
impl<V: Zero, N: RealField> Default for JointMotor<V, N> {
fn default() -> Self {
Self::new()
}
}