Robobot sensor calibration: Difference between revisions
No edit summary |
|||
(6 intermediate revisions by the same user not shown) | |||
Line 63: | Line 63: | ||
$ cd log_20240101_160442.747 | $ cd log_20240101_160442.747 | ||
$ nano log_pose.txt | $ nano log_pose.txt | ||
% Pose and velocity (log_20240101_160442.747/log_pose.txt) | % Pose and velocity (log_20240101_160442.747/log_pose.txt) | ||
% 1 Time (sec) | % 1 Time (sec) | ||
Line 90: | Line 91: | ||
If this is not the case, then adjust the driving wheel diameter "wheeldiameter" in the ''robot.ini'' file. | If this is not the case, then adjust the driving wheel diameter "wheeldiameter" in the ''robot.ini'' file. | ||
=== | === Wheelbase === | ||
Make a mission that turns or makes a square. | Make a mission that turns or makes a square. | ||
Plan 21 drives for 1m | Plan 21 (pt) drives for 1m, then repeats turning 90deg CCV, and drives for 1 meter 4 times. | ||
The last leg of the mission should be parallel | |||
The last leg of the mission should be parallel to the first meter. | |||
If this is not the case, then adjust | If this is not the case, then adjust the "wheelbase" in the ''robot.ini'' file. | ||
== Line sensor == | == Line sensor == | ||
Line 105: | Line 107: | ||
== Distance sensor == | == Distance sensor == | ||
The distance sensor (or sensors) can be calibrated using | The distance sensor (or sensors) can be calibrated using a command line option. | ||
Two distances are needed to calibrate each sensor: | |||
* 13cm and | |||
* 50cm | |||
Check where the (Sharp) distance sensor(s) are connected: | |||
[[File:dist-sensor-plug.jpg | 300px]] | |||
Place a rather big object at 50cm | |||
[[File:dist-sensor-calibrate-50.jpg | 250px]] | |||
run the ''raubase'' with these parameters for sensor 1 and distance 50cm: | |||
$ ./raubase -s1 -c50 | |||
# UService:: created directory log_20240101_164816.181/ | |||
# STeensy::setup: took 0.010085 sec to open to Teensy | |||
# STeensy::run: Confirm OK after 7 retry and 0.3125s: send';47!idi | |||
'# UService::setup - waited 0.312203 sec for initial Teensy setup | |||
# SpyVision:: disabled in robot.ini | |||
# UService::setup - waited 0.330547 sec for full setup | |||
# UService:: Teensy setup communication msg resend 6, dumped 0 messages | |||
# service is waiting for a calibration or name change to finish | |||
# SState::decode: asked for new name (idi -> name) | |||
# IR distance for '''sensor 1 at 50cm''' finished: '''13592''' 20000 | |||
# --------- terminating ----------- | |||
# UService:: configuration saved to robot.ini | |||
The result, in this case 13592, is automatically saved in the configuration file ''robot.ini''' | |||
Repeat with an object at 13cm from the sensor. | |||
== Gyro offset == | == Gyro offset == | ||
The gyro offset requires that the robot is stationary. | |||
Run the gyro calibration: | |||
$ ./raubase -g | |||
# UService:: created directory log_20240101_165457.577/ | |||
# STeensy::setup: took 0.010086 sec to open to Teensy | |||
# SState::decode: asked for new name (idi -> name) | |||
# UService::setup - waited 0.060441 sec for initial Teensy setup | |||
# SpyVision:: disabled in robot.ini | |||
# UService::setup - waited 0.078245 sec for full setup | |||
# UService:: setup of all modules finished OK. | |||
# service is waiting for a calibration or name change to finish | |||
# service is waiting for a calibration or name change to finish | |||
# '''gyro calibration finished: -0.0431824 -0.00775655 0.0200653''' | |||
# --------- terminating ----------- | |||
# UService:: configuration saved to robot.ini | |||
The result is saved in the configuration file ''robot.ini'' ready for use. |
Latest revision as of 17:17, 1 January 2024
Back to Robobot B.
Back to Robobot software description
Odometry
For odometry, there are primarily two values:
- Driving wheel diameter.
- Distance between driving wheels (wheelbase).
Both values can be measured, but the accuracy can be increased by a test. The tires flatten a bit under the weight of the robot, and the width of the tires makes the distance between the driving wheels a bit uncertain.
See Robobot level 1 for a description of odometry.
Wheel diameter
- Make a mission to drive 1m and then stop. Plan20 is (pt) just that.
- Make the plan active by changing "run" to "true" in the configuration file:
$ cd ~/svn/robobot/raubase/build $ nano robot.ini
- Ensure [plan20] has "run" = "true", and
- Ensure [pose] hase "log" = "true", something like:
[pose] gear = 19.0 wheeldiameter = 0.16 enctickperrev = 64 wheelbase = 0.25 log = true print = false [plan20] run = true log = true print = true
Measure the driven distance and compare with the distance in the pose log log_pose.txt in the log directory
$ ./raubase # UService:: created directory log_20240101_160442.747/ # STeensy::setup: took 0.010084 sec to open to Teensy # SState::decode: asked for new name (idi -> name) # UService::setup - waited 0.060424 sec for initial Teensy setup # SpyVision:: disabled in robot.ini # UService::setup - waited 0.078501 sec for full setup # UService:: setup of all modules finished OK. 1704121030.8130 10 % Plan20 started 1704121030.8131 10 % forward at 0.3m/s 1704121030.8132 11 % state start 1704121034.2158 11 % Plan20 finished # --------- terminating ----------- # UService:: configuration saved to robot.ini
Note that the created log-directory is printed on the console, here log_20240101_160442.747
Look in the log_pose.txt at the end, to see what the robot thinks.:
$ cd log_20240101_160442.747 $ nano log_pose.txt
% Pose and velocity (log_20240101_160442.747/log_pose.txt) % 1 Time (sec) % 2,3 Velocity left, right (m/s) % 4 Robot velocity (m/s) % 5 Turnrate (rad/s) % 6 Turn radius (m) % 7,8 Position x,y (m) % 9 heading (rad) % 10 Driven distance (m) - signed % 11 Turned angle (rad) - signed 1704121482.8235 0.1402 0.1403 0.0000 0.00000 0.000 0.000 0.000 0.0000 0.000 0.0000 1704121482.8316 0.0348 0.0348 0.0000 0.00000 0.000 0.000 0.000 0.0000 0.000 0.0000 1704121482.8397 -0.0200 0.0000 -0.0100 0.08214 -0.122 -0.000 -0.000 0.0016 -0.000 0.0016 1704121482.8477 0.0469 0.0000 0.0235 -0.19302 -0.122 0.000 0.000 0.0000 0.000 0.0000 1704121482.8552 0.0000 0.1514 0.0757 0.62315 0.122 0.001 0.000 0.0047 0.001 0.0047 ... 1704121487.1912 0.0005 0.0005 0.0000 0.00000 0.000 1.016 -0.000 0.0016 1.016 0.0016 1704121487.2001 0.0005 0.0005 0.0000 0.00000 0.000 1.016 -0.000 0.0016 1.016 0.0016 1704121487.2075 0.0005 0.0005 0.0000 0.00000 0.000 1.016 -0.000 0.0016 1.016 0.0016 1704121487.2155 0.0004 0.0005 0.0000 0.00000 0.000 1.016 -0.000 0.0016 1.016 0.0016 1704121487.2241 0.0004 0.0004 0.0000 0.00000 0.000 1.016 -0.000 0.0016 1.016 0.0016 1704121487.2318 0.0004 0.0004 0.0000 0.00000 0.000 1.016 -0.000 0.0016 1.016 0.0016
Column 10 (driven distance) shows 1.016 m, i.e. the actual driven distance should be 101.6 cm.
If this is not the case, then adjust the driving wheel diameter "wheeldiameter" in the robot.ini file.
Wheelbase
Make a mission that turns or makes a square.
Plan 21 (pt) drives for 1m, then repeats turning 90deg CCV, and drives for 1 meter 4 times.
The last leg of the mission should be parallel to the first meter.
If this is not the case, then adjust the "wheelbase" in the robot.ini file.
Line sensor
See Line sensor for details.
Distance sensor
The distance sensor (or sensors) can be calibrated using a command line option. Two distances are needed to calibrate each sensor:
- 13cm and
- 50cm
Check where the (Sharp) distance sensor(s) are connected:
Place a rather big object at 50cm
run the raubase with these parameters for sensor 1 and distance 50cm:
$ ./raubase -s1 -c50 # UService:: created directory log_20240101_164816.181/ # STeensy::setup: took 0.010085 sec to open to Teensy # STeensy::run: Confirm OK after 7 retry and 0.3125s: send';47!idi '# UService::setup - waited 0.312203 sec for initial Teensy setup # SpyVision:: disabled in robot.ini # UService::setup - waited 0.330547 sec for full setup # UService:: Teensy setup communication msg resend 6, dumped 0 messages # service is waiting for a calibration or name change to finish # SState::decode: asked for new name (idi -> name) # IR distance for sensor 1 at 50cm finished: 13592 20000 # --------- terminating ----------- # UService:: configuration saved to robot.ini
The result, in this case 13592, is automatically saved in the configuration file robot.ini'
Repeat with an object at 13cm from the sensor.
Gyro offset
The gyro offset requires that the robot is stationary.
Run the gyro calibration:
$ ./raubase -g # UService:: created directory log_20240101_165457.577/ # STeensy::setup: took 0.010086 sec to open to Teensy # SState::decode: asked for new name (idi -> name) # UService::setup - waited 0.060441 sec for initial Teensy setup # SpyVision:: disabled in robot.ini # UService::setup - waited 0.078245 sec for full setup # UService:: setup of all modules finished OK. # service is waiting for a calibration or name change to finish # service is waiting for a calibration or name change to finish # gyro calibration finished: -0.0431824 -0.00775655 0.0200653 # --------- terminating ----------- # UService:: configuration saved to robot.ini
The result is saved in the configuration file robot.ini ready for use.