<commit_before>Arlobot Acceleration Testing
(and maximum/minimum speed)

NOTE: The actual values here are not specifically used in the parameter files,
because setting them exactly causes DWA to behave oddly.
For instance:
1. You have to set minimum rotational and x speeds to 0, or the robot thinks
it cannot spin in place, or move forward without rotating.
2. Setting the exact acceleration values causes the robot to spin and rotate
without ever achieving its destination.
3. You may want to set less than actual max speed for health and safety.

So use this for info and experimenting, but don't go copying these blindly
into param/*.yaml files.

These settings are used in
dwa_local_planner_params.yaml
    under both arlobot_navigation and arlobot_explore
and base_local_planenr_params.yaml
    under arlobot_explore

The robot behaves much better if the acceleration is limited.
I do this by setting the ACC in the motor controller to 150 instead of the default 512:
dhb10_com("ACC 150\r");

I used the MotorResponseTesting.c script to get these numbers.
Be sure to test your robot ON THE FLOOR, because
everything is different with resistance than it is if the wheels are off of the ground.

For the maximum speed don't just look for the max it can reach,
but the max it reaches in a consistent time.
If it takes 1 second sometimes and 3 others, that is too fast and you are
just barely hitting that speed randomly.

LINEAR (X):

Maximum Linear speed: 0.74 m/s (218 TPS) - max_vel_x
On the Floor:
It doesn't reach 0.80, at least not in a reasonable distance.
0.75 equates to 222 TPS, which is above the max angular TPS.
0.74 seems consistent. It seems like it can got a lot faster in a straight
line than a circle, probably because of momentum.
Up on Blocks:
It will never reach 0.830, but it will ramp up to 0.820 quickly.
0.80 is probably a safe maximum speed to avoid having it bump about close to what it cannot reach.
It can do 0.80 steadily up on blocks.

NOTE: This depends on setting:
#define DHB10_NORMAL_ACC 150
in per_robot_settings_for_propeller_c_code.h

Maximum Linear Acceleration: 0.7 m/s^2 - acc_lim_x

Linear (forward)
0 to 0.74 m/s
1033
1033
1033
933
1033
1033
1033
1033 = 0.716360116166505
933
1033
1033
933
1033
1033
1033
933
http://www.smartconversion.com/unit_calculation/Acceleration_calculator.aspx

0.74 to 0 m/s
1888
1588
1888
1588
1888
1688
1588
1888
1588
1888
1988
1988
1788
1488
1588
1888
http://www.smartconversion.com/unit_calculation/Acceleration_calculator.aspx
On Blocks it stopped from 0.80 in 1283 ms every single time.

Minimum Linear Velocity: 0.06 m/s (18 TPS)
NOTE: Don't set min_vel_x to this or DWA will not work properly.
Up on blocks:
At 0.04 it doesn't jerk, but it still waddles a bit.
At 0.03 and below it just jerks back and forth, each wheel moving a bit.

ANGULAR (theta):

Maximum Angular Velocity: 3.6 rad/s (214 TPS) - max_rot_vel
Up on blocks it can do:
At 4.0 rad/s it consistently reaches the speed every time and runs.
At 4.1 rad/s it runs forever without attaining the requested speed.
At 4.2 rad/s one of the motors actually starts to give up and run slow!
Above this sometimes one wheel actually slows down while the other keeps trying.
On the floor:
Setting to 3.6 (214 TPS) because it is still plenty fast enough and stays under max linear TPS of 218, and MAXIMUM SPEED can be set to 220 and be above both.
It reaches 3.7 (220 TPS) very consistently.
It reaches 3.8 always, but sometimes it takes 1.5 seconds and sometimes 3.3!
It will never reach 3.9, just spinning forever.
At 4.0, on the floor, one wheel actually slows down eventually and it gets crazy!

NOTE: This depends on setting:
#define DHB10_NORMAL_ACC 150
in per_robot_settings_for_propeller_c_code.h

Angular Acceleration:  1.5 rad/s^2 - acc_lim_theta

Angular (positive) [ON THE FLOOR!]
0 to 3.6 rad/s
936
1036
936
1036
937
937
1037
1036 = 1.54440154440154
1036
936
935

3.6 to 0 rad/s
1285
1185
1285
1185
1184
1384
1384
1284
1384
1383
1185

Minimum Angular Velocity: 0.3 rad/s (18 TPS) - min_trans_vel
Below this it is very jerky.
It sometimes sounds funny at 0.3 rad/s, but it is smooth.

If you make changes, be sure to adjust MAXIMUM_SPEED and MINIMUM_SPEED in per_robot_settings_for_propeller_c_code.h


Some snippets:
From a goal in front of the robot:
data: 19012, out: s,0.060,-0.164
data: 19013, out: s,0.060,-0.164
data: 19013, out: s,0.060,-0.164
data: 19014, out: s,0.060,-0.164
data: 19014, out: s,0.060,-0.164
data: 19015, out: s,0.060,-0.164
data: 19017, out: s,0.060,-0.122
data: 19017, out: s,0.060,-0.122
data: 19018, out: s,0.060,-0.097
data: 19019, out: s,0.060,-0.071
data: 19019, out: s,0.060,-0.071
data: 19020, out: s,0.078,-0.012
data: 19020, out: s,0.078,-0.012

trackWidth: 0.403 - arlobot.yaml
angularVelocityOffset = CommandedAngularVelocity * (trackWidth * 0.5);
angularVelocityOffset = (-0.164 * (0.403 * 0.5))
angularVelocityOffset = −0.033046


Normal (if result isn't above max speed, figure that later)
newCommandedVelocity = CommandedVelocity;
expectedLeftSpeed = newCommandedVelocity - angularVelocityOffset;
expectedLeftSpeed = 0.060 - −0.033046;
expectedLeftSpeed = 0.093046<commit_msg>Clarify where to make updates to maximum robot speed.<commit_after>Arlobot Acceleration Testing
(and maximum/minimum speed)

NOTE: The actual values here are not specifically used in the parameter files,
because setting them exactly causes DWA to behave oddly.
For instance:
1. You have to set minimum rotational and x speeds to 0, or the robot thinks
it cannot spin in place, or move forward without rotating.
2. Setting the exact acceleration values causes the robot to spin and rotate
without ever achieving its destination.
3. You may want to set less than actual max speed for health and safety.

So use this for info and experimenting, but don't go copying these blindly
into param/*.yaml files.

These settings are used in
dwa_local_planner_params.yaml
    under both arlobot_navigation and arlobot_explore
and base_local_planenr_params.yaml
    under arlobot_explore

The robot behaves much better if the acceleration is limited.
I do this by setting the ACC in the motor controller to 150 instead of the default 512:
dhb10_com("ACC 150\r");

I used the MotorResponseTesting.c script to get these numbers.
Be sure to test your robot ON THE FLOOR, because
everything is different with resistance than it is if the wheels are off of the ground.

For the maximum speed don't just look for the max it can reach,
but the max it reaches in a consistent time.
If it takes 1 second sometimes and 3 others, that is too fast and you are
just barely hitting that speed randomly.

LINEAR (X):

Maximum Linear speed: 0.74 m/s (218 TPS) - max_vel_x
On the Floor:
It doesn't reach 0.80, at least not in a reasonable distance.
0.75 equates to 222 TPS, which is above the max angular TPS.
0.74 seems consistent. It seems like it can got a lot faster in a straight
line than a circle, probably because of momentum.
Up on Blocks:
It will never reach 0.830, but it will ramp up to 0.820 quickly.
0.80 is probably a safe maximum speed to avoid having it bump about close to what it cannot reach.
It can do 0.80 steadily up on blocks.

NOTE: This depends on setting:
#define DHB10_NORMAL_ACC 150
in per_robot_settings_for_propeller_c_code.h

Maximum Linear Acceleration: 0.7 m/s^2 - acc_lim_x

Linear (forward)
0 to 0.74 m/s
1033
1033
1033
933
1033
1033
1033
1033 = 0.716360116166505
933
1033
1033
933
1033
1033
1033
933
http://www.smartconversion.com/unit_calculation/Acceleration_calculator.aspx

0.74 to 0 m/s
1888
1588
1888
1588
1888
1688
1588
1888
1588
1888
1988
1988
1788
1488
1588
1888
http://www.smartconversion.com/unit_calculation/Acceleration_calculator.aspx
On Blocks it stopped from 0.80 in 1283 ms every single time.

Minimum Linear Velocity: 0.06 m/s (18 TPS)
NOTE: Don't set min_vel_x to this or DWA will not work properly.
Up on blocks:
At 0.04 it doesn't jerk, but it still waddles a bit.
At 0.03 and below it just jerks back and forth, each wheel moving a bit.

ANGULAR (theta):

Maximum Angular Velocity: 3.6 rad/s (214 TPS) - max_rot_vel
Up on blocks it can do:
At 4.0 rad/s it consistently reaches the speed every time and runs.
At 4.1 rad/s it runs forever without attaining the requested speed.
At 4.2 rad/s one of the motors actually starts to give up and run slow!
Above this sometimes one wheel actually slows down while the other keeps trying.
On the floor:
Setting to 3.6 (214 TPS) because it is still plenty fast enough and stays under max linear TPS of 218, and MAXIMUM SPEED can be set to 220 and be above both.
It reaches 3.7 (220 TPS) very consistently.
It reaches 3.8 always, but sometimes it takes 1.5 seconds and sometimes 3.3!
It will never reach 3.9, just spinning forever.
At 4.0, on the floor, one wheel actually slows down eventually and it gets crazy!

NOTE: This depends on setting:
#define DHB10_NORMAL_ACC 150
in per_robot_settings_for_propeller_c_code.h

Angular Acceleration:  1.5 rad/s^2 - acc_lim_theta

Angular (positive) [ON THE FLOOR!]
0 to 3.6 rad/s
936
1036
936
1036
937
937
1037
1036 = 1.54440154440154
1036
936
935

3.6 to 0 rad/s
1285
1185
1285
1185
1184
1384
1384
1284
1384
1383
1185

Minimum Angular Velocity: 0.3 rad/s (18 TPS) - min_trans_vel
Below this it is very jerky.
It sometimes sounds funny at 0.3 rad/s, but it is smooth.

If you make changes, be sure to adjust
propellerMaxSpeeds: {abd_speedLimit: 220, abdR_speedLimit: 220}
in ~/catkin_ws/src/ArloBot/src/arlobot/arlobot_bringup/param/arlobot.yaml

Some snippets:
From a goal in front of the robot:
data: 19012, out: s,0.060,-0.164
data: 19013, out: s,0.060,-0.164
data: 19013, out: s,0.060,-0.164
data: 19014, out: s,0.060,-0.164
data: 19014, out: s,0.060,-0.164
data: 19015, out: s,0.060,-0.164
data: 19017, out: s,0.060,-0.122
data: 19017, out: s,0.060,-0.122
data: 19018, out: s,0.060,-0.097
data: 19019, out: s,0.060,-0.071
data: 19019, out: s,0.060,-0.071
data: 19020, out: s,0.078,-0.012
data: 19020, out: s,0.078,-0.012

trackWidth: 0.403 - arlobot.yaml
angularVelocityOffset = CommandedAngularVelocity * (trackWidth * 0.5);
angularVelocityOffset = (-0.164 * (0.403 * 0.5))
angularVelocityOffset = −0.033046


Normal (if result isn't above max speed, figure that later)
newCommandedVelocity = CommandedVelocity;
expectedLeftSpeed = newCommandedVelocity - angularVelocityOffset;
expectedLeftSpeed = 0.060 - −0.033046;
expectedLeftSpeed = 0.093046
{'fraction_non_alphanumeric': 0.06812511993859144, 'fraction_numerical': 0.11322203032047591, 'mean_word_length': 4.177844013909588, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3310403', 'n_tokens_mistral': 4276, 'n_tokens_neox': 3491, 'n_words': 1575}