diff --git a/Chapter05/src/motion_controllers.rs b/Chapter05/src/motion_controllers.rs index de56892..9b3f910 100644 --- a/Chapter05/src/motion_controllers.rs +++ b/Chapter05/src/motion_controllers.rs @@ -98,7 +98,7 @@ impl MotionController for SmoothMotionController //may happen if time delta underflows 0.0 } else { - 0.0 + target_force } } } diff --git a/Chapter05/src/motor1.c b/Chapter05/src/motor1.c index 8cb9bbe..183b8a0 100644 --- a/Chapter05/src/motor1.c +++ b/Chapter05/src/motor1.c @@ -1,6 +1,6 @@ -int motor1_adjust_motor(double target_force){ +double motor1_adjust_motor(double target_force){ //real driver would do something here //interface with physical components - return 0; + return target_force; } diff --git a/Chapter05/src/motor2.c b/Chapter05/src/motor2.c index fc051fa..fec3fe0 100644 --- a/Chapter05/src/motor2.c +++ b/Chapter05/src/motor2.c @@ -1,6 +1,6 @@ -int motor2_adjust_motor(double target_force){ +double motor2_adjust_motor(double target_force){ //real driver would do something here //interface with physical components - return 0; + return target_force; } diff --git a/Chapter05/src/motor3.c b/Chapter05/src/motor3.c index f77136f..1f2922f 100644 --- a/Chapter05/src/motor3.c +++ b/Chapter05/src/motor3.c @@ -1,6 +1,6 @@ -int motor3_adjust_motor(double target_force){ +double motor3_adjust_motor(double target_force){ //real driver would do something here //interface with physical components - return 0; + return target_force; } diff --git a/Chapter05/src/physics.rs b/Chapter05/src/physics.rs index 7f8e4ef..501210f 100644 --- a/Chapter05/src/physics.rs +++ b/Chapter05/src/physics.rs @@ -15,7 +15,7 @@ pub struct ElevatorState { pub motor_input: f64 } -pub const MAX_JERK: f64 = 0.2; +pub const MAX_JERK: f64 = 20.0; pub const MAX_ACCELERATION: f64 = 2.0; pub const MAX_VELOCITY: f64 = 5.0; diff --git a/Chapter05/test1.txt b/Chapter05/test1.txt new file mode 100644 index 0000000..3328062 --- /dev/null +++ b/Chapter05/test1.txt @@ -0,0 +1,3 @@ +1 +1 +2