Skip to content

Commit 1cf94c4

Browse files
author
guoyongchao
committed
update example
1 parent b840379 commit 1cf94c4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

docs/samples.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,21 @@ pid_control_t right_pid = pid_create();
3737
c_wheels[0] = wheel_create(left_motor, left_encoder, left_pid, WHEEL_RADIUS, GEAR_RATIO);
3838
c_wheels[1] = wheel_create(right_motor, right_encoder, right_pid, WHEEL_RADIUS, GEAR_RATIO);
3939

40-
4140
// 2. Iinialize Kinematics - Two Wheel Differential Drive
4241
kinematics_t c_kinematics = kinematics_create(TWO_WD, WHEEL_DIST_X, WHEEL_DIST_Y, WHEEL_RADIUS);
4342

4443
// 3. Initialize Chassis
4544
chas = chassis_create(c_wheels, c_kinematics);
4645

47-
// 4. Enable Chassis
48-
chassis_enable(chas);
49-
50-
// Set Sample time
46+
// 4. Set Sample time
5147
encoder_set_sample_time(chas->c_wheels[0]->w_encoder, SAMPLE_TIME);
5248
encoder_set_sample_time(chas->c_wheels[1]->w_encoder, SAMPLE_TIME);
5349
pid_set_sample_time(chas->c_wheels[0]->w_pid, PID_SAMPLE_TIME);
5450
pid_set_sample_time(chas->c_wheels[1]->w_pid, PID_SAMPLE_TIME);
5551

52+
// 5. Enable Chassis
53+
chassis_enable(chas);
54+
5655
// Turn left
5756
target_vel.linear_x = 0; // m/s
5857
target_vel.linear_y = 0; // m/s

0 commit comments

Comments
 (0)