guoyongchao 6 лет назад
Родитель
Сommit
1cf94c488f
1 измененных файлов с 4 добавлено и 5 удалено
  1. 4 5
      docs/samples.md

+ 4 - 5
docs/samples.md

@@ -37,22 +37,21 @@ pid_control_t right_pid = pid_create();
 c_wheels[0] = wheel_create(left_motor,  left_encoder,  left_pid,  WHEEL_RADIUS, GEAR_RATIO);
 c_wheels[1] = wheel_create(right_motor, right_encoder, right_pid, WHEEL_RADIUS, GEAR_RATIO);
 
-
 // 2. Iinialize Kinematics - Two Wheel Differential Drive
 kinematics_t c_kinematics = kinematics_create(TWO_WD, WHEEL_DIST_X, WHEEL_DIST_Y, WHEEL_RADIUS);
 
 // 3. Initialize Chassis
 chas = chassis_create(c_wheels, c_kinematics);
 
-// 4. Enable Chassis
-chassis_enable(chas);
-
-// Set Sample time
+// 4. Set Sample time
 encoder_set_sample_time(chas->c_wheels[0]->w_encoder, SAMPLE_TIME);
 encoder_set_sample_time(chas->c_wheels[1]->w_encoder, SAMPLE_TIME);
 pid_set_sample_time(chas->c_wheels[0]->w_pid, PID_SAMPLE_TIME);
 pid_set_sample_time(chas->c_wheels[1]->w_pid, PID_SAMPLE_TIME);
 
+// 5. Enable Chassis
+chassis_enable(chas);
+
 // Turn left
 target_vel.linear_x = 0;   // m/s
 target_vel.linear_y = 0;    // m/s