GoPi5Go Docking In Progress

First tests are showing promise (and complexity of reality):

pi@GoPi5Go:~/GoPi5Go/systests/docking $ ./docking.py 
docking.main(): Test:  0
Undocking Begins
Undocking Complete
Docking Begins
vbatt: 11.54  d(vBatt):  0.374  max d(vBatt):  0.374             
Docking: Success


docking.main(): Test:  1
Undocking Begins
Undocking Complete
Docking Begins
vbatt: 11.53  d(vBatt):  0.331  max d(vBatt):  0.331             
Docking: Success


docking.main(): Test:  2
Undocking Begins
Undocking Complete
Docking Begins
vbatt: 11.56  d(vBatt):  0.383  max d(vBatt):  0.383             
Docking: Success


...

docking.main(): Test:  10
Undocking Begins
Undocking Complete
Docking Begins
vbatt: 11.52  d(vBatt):  0.340  max d(vBatt):  0.340             
Docking: Success


... 

From here on the sensors used claimed success but no juice connection was actually made:

...

docking.main(): Test:  16
Undocking Begins
Undocking Complete
Docking Begins
Exception OSError: No SPI response vReading:0.00 continuing      
vbatt: 11.03  d(vBatt):  0.100  max d(vBatt):  0.100             
Docking: Success


...

docking.main(): Test:  19
Undocking Begins
Undocking Complete
Docking Begins
vbatt: 11.01  d(vBatt):  0.100  max d(vBatt):  0.100             
Docking: Success


docking.main(): TEST COMPLETE

Appears that just stopping the motors caused average battery voltage to bounce the 0.1 volt threshold chosen as “Docking Success”

2 Likes

Second try - “drive with bias” is probably a stupid choice - It works wonderfully for the particular “undock, don’t go anywhere, dock” test, but is probably fragile. For the moment, GoPi5Go-Dave is enjoying “(almost) Carl Equivalent Docking”

2024-04-11 15:50|[logMaintenance.py.main]** Configured SPI max speed to 250kHz in Dexter/GoPiGo3 API (gopigo3.py in .egg) **
2024-04-11 16:14|[logMaintenance.py.main]** Starting safetyShutdown.py at 11.13 volts. **
2024-04-13 12:30|[logMaintenance.py.main]** Testing test_docking.py **
2024-04-13 12:32|[test_docking.py.main]Battery at 90%, undocking
2024-04-13 15:31|[test_docking.py.main]Battery at 10%, Docking: success (assumed)
2024-04-13 20:46|[test_docking.py.main]Battery at 90%, undocking
2024-04-13 23:39|[test_docking.py.main]Battery at 10%, Docking: success (assumed)
2024-04-14 04:33|[test_docking.py.main]Battery at 90%, undocking
2024-04-14 07:25|[test_docking.py.main]Battery at 10%, Docking: success (assumed)
2024-04-14 08:33|lifelogger.dEmain execution: 66.20

Need to integrate the success recognition strategy from the first docking method to the drive with bias method, then add more start pose tolerance, and a failure recovery technique.

Have not seen a “No SPI Response” exception since I decreased the SPI max frequency; considering that issue closed.

2 Likes

Oh wow - was reminded by this chart that the voltage to battery charge curve during charging is drastically different from during discharge:
Li-Ion_Charge_Profile

A bunch more investigation needed, and possibly integrating time at a voltage or some other “cheat” to recognize when to get off the dock since I prefer not to put a current sensor in front of the battery.

BUT THEN AGAIN… I just happen to have an INA219 I2C Voltage and Current Sensor already set up with two 5.5x2.1mm barrel connectors and a “Grove I2C” connector wired for the GoPiGo3 I2C ports.

Ah but wait…this is the Raspberry Pi5 so the pypi pi-ina219 library bombs out with “unsupported platform”.

So miracles sometimes happen and I managed to port the Adafruit pi-ina219 driver to use the di_i2c package to talk to the chip!

pi@GoPi5Go:~/GoPi5Go/systests/ina219/pi_ina219 $ ./example.py 
2024-04-16 13:35:18,223 - INFO - INA219 gain set to 0.04V
2024-04-16 13:35:18,223 - INFO - INA219 calibrate called with: bus max volts: 16V, max shunt volts: 0.04V, max expected amps: 0.200A
2024-04-16 13:35:18,223 - INFO - INA219 max possible current: 0.400A
2024-04-16 13:35:18,223 - INFO - INA219 max expected current: 0.200A
2024-04-16 13:35:18,223 - INFO - INA219 current LSB: 6.250e-06 A/bit
2024-04-16 13:35:18,223 - INFO - INA219 power LSB: 1.250e-04 W/bit
2024-04-16 13:35:18,223 - INFO - INA219 max current before overflow: 0.2048A
2024-04-16 13:35:18,223 - INFO - INA219 max shunt voltage before overflow: 20.4800mV
2024-04-16 13:35:18,223 - INFO - INA219 calibration: 0xfffe (65534)
Bus Voltage    : 12.256 V
2024-04-16 13:35:18,226 - INFO - INA219 Current overflow detected - attempting to increase gain
2024-04-16 13:35:18,227 - INFO - INA219 gain is currently: 0.04V
2024-04-16 13:35:18,227 - INFO - INA219 calibrate called with: bus max volts: 16V, max shunt volts: 0.08V
2024-04-16 13:35:18,227 - INFO - INA219 max possible current: 0.800A
2024-04-16 13:35:18,227 - INFO - INA219 current LSB: 2.439e-05 A/bit
2024-04-16 13:35:18,227 - INFO - INA219 power LSB: 4.878e-04 W/bit
2024-04-16 13:35:18,227 - INFO - INA219 max current before overflow: 0.7992A
2024-04-16 13:35:18,227 - INFO - INA219 max shunt voltage before overflow: 79.9195mV
2024-04-16 13:35:18,227 - INFO - INA219 calibration: 0x4199 (16793)
2024-04-16 13:35:18,229 - INFO - INA219 gain set to: 0.08V
Bus Current    : -393.463 mA
Supply Voltage : 12.204 V
Shunt voltage  : -40.020 mV
Power          : 4761.951 mW

Which is 1mA different and 0.04v different than my other meter is reading.
(Photo is a different time than INA219 measurement)

Holy Cow!!

2 Likes

Sure enough - even this 3 year old battery shows similar curve. (Above is no load charging, GoPi5Go-Dave’s is charging while powering a 6.6W load. 12.6v 1A charger allows 6W to charging, 6.6W to power load.)

But the Discharge Profile (current meter allows measuring actual power capacity) reveals the 3000mAh 27Wh battery when new is now only delivering 1252mAh 13.8Wh - less than half rated capacity - time for a new battery. (New battery arriving Saturday.)

2 Likes

New Talencell 3000mAh Battery

The new battery combined with a new 2A Talentcell charger is getting tested along with my “test_docking.py” program:

First discharge from full charge to battery cutout:

And first charge from cutout to charging current less than 20mA:

I need to convert all my voltage measurements over to using the new INA219 Current and Voltage Sensor, since it appears proper battery management needs to be based on watching charge current.

The chart above mentions 3% C as the charging cutoff so for a “C” of 3A then the cutoff would be 90mA. I’ve been using 20mA as the “full charge” point.

Interestingly, when I remove my duplicate voltmeter leaving only the INA219 sensor between the battery and the recharger, the charger chooses its full starting current which results in 1.5A to the battery and 0.5A to the robot. This results in 0.5C - the suggested charge rate.

2 Likes

Over 3.5 hours runtime.

Looking at the charge curve - what do you consider a good balance? Looks like somewhere between 2 and 2.5 hours gets you pretty much there - the extra charge time may not be worth the wait. Actually anything over 1.5 h may not be worth the wait.
/K

2 Likes

What a great question. The values for charge:

# FILE:  test_docking.py

"""
   USAGE:  Set NUM_OF_DOCKING_TESTS and then execute ./test_docking.py

   PROCESS:  Monitor INA219 current and voltage sensor
             Undock when charging current falls below cutoff target
             Dock when voltage reaches 9.85v

   RESULTS:

       time - charge - cutoff - estimated more playtime at 6.5W average load
       1.5h - 23.3Wh - 643mA =  (3h 6m)
       2.0h - 26.1Wh - 331mA      +21m
       2.5h - 27.5Wh - 176mA      +11m (xtra hour charge = 32m xtra playtime)
       3.5h - 28.5Wh - 20mA       + 8m (xtra hour charge =  8m xtra playtime)
"""

I’m going to test docking/charging till the current drops below 175mA to get that extra 30m. Super observation @KeithW

It would appear there is a 10% charging loss - 28.5Wh charge gets 25.7Wh playtime.
Charging my Prius with 120v has a 30% loss, so Dave has more efficient charging. Wonder if he beats 4.4 mi/kWh?

pi@GoPi5Go:~/GoPi5Go/systests/docking $ ~/GoPi5Go/utils/print_daveDataJson.py 
daveData.json contents:
   lastDocking  :  ---- Docking 423 : success at 0% 9.9v after 3.9 h playtime
   chargeCycles  :  422
   lastDismount  :  ---- Undocking at Charge Current 20 mA 12.20v after 3.7 h charging
   dockingState  :  undocked
   chargingState  :  discharging
   lastDismountTime  :  2024-04-23 06:13:33
   lastRechargeDuration  :  3.7
   newBatteryDate  :  2024-04-19
   newBatteryAtDocking  :  416
   newBatteryAtLifeHours  :  694
   newBatteryDesc  :  TalentCell YB1203000-USB 12v 3000mAh
   lastDockingTime  :  2024-04-23 02:28:51
   lastPlaytimeDuration  :  3.9

*** GoPi5Go Dave TOTAL LIFE STATISTICS ***
Total Awake:   784.45  hrs
Total Naps:     57.05  hrs
Total Life:    841.50  hrs (since Mar 17, 2024)
GoPi5Go-Dave Playtimes (Undocked-Docked): 31
Total Dockings:  423
New Battery Installed At Cycle: 416
This Battery At Cycle:  7
Average playtime (last three) 3.7 hrs 
Average docked time (last three) 4.2 hrs 
Sessions (boot):  60
Average Session:  13.0 hrs
Safety Shutdowns:  6
Total Travel:  10.0 meters 32.8 feet
 
Last Undocking String:  2024-04-23 06:13|[test_docking.py.main]---- Undocking at Charge Current 20 mA 12.20v after 3.7 h charging
Last Docking   String:  2024-04-23 02:28|[test_docking.py.main]---- Docking 423 : success at 0% 9.9v after 3.9 h playtime


1 Like

Glad I was able to help a little.

So past 1.5h an extra 30 min charging only gets you 21 minutes of run time. So my eye-ball estimate looks like it wasn’t bad regarding 1.5h being the sweet spot. I’m sure you could refine it further to figure out precisely when your charge time starts yielding less than 1:1 for run time.
/K

2 Likes

Testing Update

  • Charging until current drops below 175mA yields { 2.4h charge, 3.9h idle-playtime } - roughly 4 cycles/day
  • 12 Docking / 3 day Test:
    • 2 mysterious “did not undock autonomously”
    • 1 mechanical docking failure
    • 1 false “docking failure detection”

I have ideas to improve the mechanical docking process, and to eliminate false docking failures.

I don’t have a clue about how the program missed the charging current cutoff condition.

I am running another program that accesses the INA219 sensor once every three minutes, but the docking test program is checking once every six seconds, so even if there was an access collision the test program should not collide the next current check. Additionally, that other program showed very normal charge current profile dropping below 175 mA and eventually the charger switching to “discharge then trickle” cycling. I probably should use the di_mutex around the I2C sensor to be sure collisions aren’t affecting the test program.

2024-04-25 23:51|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.12v after 2.5 h charging
2024-04-26 03:42|[test_docking.py.do_playtime]---- Docking 434 : success at 0% 9.9v after 3.8 h playtime
2024-04-26 06:07|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.13v after 2.4 h charging
2024-04-26 09:58|[test_docking.py.do_playtime]---- Docking 435 : success at 0% 9.8v after 3.8 h playtime
2024-04-26 12:21|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.13v after 2.4 h charging
2024-04-26 16:12|[test_docking.py.do_playtime]---- Docking 436 : success at 0% 9.9v after 3.9 h playtime
2024-04-26 18:38|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.12v after 2.4 h charging
2024-04-26 22:30|[test_docking.py.do_playtime]---- Docking 437 : success at 0% 9.9v after 3.9 h playtime
2024-04-27 00:54|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.13v after 2.4 h charging
2024-04-27 04:46|[test_docking.py.do_playtime]---- Docking 438 : success at 0% 9.8v after 3.9 h playtime
2024-04-27 07:11|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.12v after 2.4 h charging
2024-04-27 11:03|[test_docking.py.do_playtime]---- Docking 439 : success at 0% 9.9v after 3.9 h playtime
2024-04-27 13:28|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.13v after 2.4 h charging
2024-04-27 17:22|[test_docking.py.do_playtime]---- Docking 440 : success at 0% 9.8v after 3.9 h playtime

2024-04-27 23:36|[logMaintenance.py.main]** ---- Undocking Manual - test_docking.py did not undock when fully charged **

2024-04-28 03:42|[test_docking.py.do_playtime]Battery at 9.9v 4%, Docking: failure
2024-04-28 03:42|[logMaintenance.py.main]** ---- Docking 441 : success -  false dock failure **

2024-04-28 08:37|[logMaintenance.py.main]** ---- Undocking Manual - test_docking.py did not undock when fully charged **

2024-04-28 12:37|[test_docking.py.do_playtime]Battery at 9.9v 4%, Docking: failure
2024-04-28 12:37|[logMaintenance.py.main]** ---- Manual Docking 442 : success **

2024-04-28 15:01|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.11v after 2.4 h charging
2024-04-28 18:54|[test_docking.py.do_playtime]---- Docking 443 : success at 0% 9.9v after 3.9 h playtime
2024-04-28 21:19|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.13v after 2.4 h charging
2024-04-29 01:11|[test_docking.py.do_playtime]---- Docking 444 : success at 0% 9.9v after 3.9 h playtime
2024-04-29 03:35|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.13v after 2.4 h charging
2024-04-29 07:25|[test_docking.py.do_playtime]---- Docking 445 : success at 0% 9.9v after 3.8 h playtime

2 Likes

GoPi5Go-Dave just passed 12 undock/dock cycles in 3 days (and 2 minutes), with no “strangeness”. Having only the test program accessing the INA219A sensor seems to confirm my suspicion of I2C collision as the source of test issues.

*** GoPi5Go Dave TOTAL LIFE STATISTICS ***
Total Awake:   1047.15  hrs
Total Naps:     57.05  hrs
Total Life:    1104.20  hrs (since Mar 17, 2024)
GoPi5Go-Dave Playtimes (Undocked-Docked): 72
Total Dockings:  465
New Battery Installed At Cycle: 416
This Battery At Cycle:  49
Average playtime (last three) 3.8 hrs 
Average docked time (last three) 2.4 hrs 

2024-05-01 11:11|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.12v after 2.4 h charging
2024-05-01 15:00|[test_docking.py.do_playtime]---- Docking 454 : success at 0% 10.0v after 3.8 h playtime
2024-05-01 17:26|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.12v after 2.4 h charging
2024-05-01 21:14|[test_docking.py.do_playtime]---- Docking 455 : success at 0% 9.9v after 3.8 h playtime
2024-05-01 23:40|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.14v after 2.4 h charging
2024-05-02 03:30|[test_docking.py.do_playtime]---- Docking 456 : success at 0% 9.9v after 3.8 h playtime
2024-05-02 05:51|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.13v after 2.4 h charging
2024-05-02 09:41|[test_docking.py.do_playtime]---- Docking 457 : success at 0% 9.9v after 3.8 h playtime
2024-05-02 12:04|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.13v after 2.4 h charging
2024-05-02 15:57|[test_docking.py.do_playtime]---- Docking 458 : success at 0% 10.0v after 3.9 h playtime
2024-05-02 18:18|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.12v after 2.4 h charging
2024-05-02 22:06|[test_docking.py.do_playtime]---- Docking 459 : success at 0% 9.9v after 3.8 h playtime
2024-05-03 00:29|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.13v after 2.4 h charging
2024-05-03 04:20|[test_docking.py.do_playtime]---- Docking 460 : success at 0% 9.9v after 3.8 h playtime
2024-05-03 06:40|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.11v after 2.3 h charging
2024-05-03 10:27|[test_docking.py.do_playtime]---- Docking 461 : success at 0% 9.9v after 3.8 h playtime
2024-05-03 12:50|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.12v after 2.4 h charging
2024-05-03 16:41|[test_docking.py.do_playtime]---- Docking 462 : success at 0% 9.9v after 3.9 h playtime
2024-05-03 19:02|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.11v after 2.4 h charging
2024-05-03 22:50|[test_docking.py.do_playtime]---- Docking 463 : success at 0% 10.0v after 3.8 h playtime
2024-05-04 01:13|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.12v after 2.4 h charging
2024-05-04 05:03|[test_docking.py.do_playtime]---- Docking 464 : success at 0% 9.9v after 3.8 h playtime
2024-05-04 07:24|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.12v after 2.4 h charging
2024-05-04 11:13|[test_docking.py.do_playtime]---- Docking 465 : success at 0% 9.9v after 3.8 h playtime

Now to add a mutex to the sensor driver and test two programs again. (This is another example of why the GoPiGo3 is such a great educational platform - the “Easy Sensor” mutex protected pattern is easily implemented for any “not Easy” sensor.)

2 Likes

Don’t forget to make a docking alignment guide for Dave too.

2 Likes

The main secret of success - refined, and smaller than Carl’s:

As yet, the size of the “ready to dock circle of confusion” has not been determined. The plan is to use visual Aruco marker recognition, angle, and distance to navigate to the “ready to dock” position, then turn 180 and perform the current dock() function. I may use the LIDAR to confirm the distance to back-up so that I don’t repeat that sad ending from the initial video.

2 Likes

Weirdness - even with the di_mutex, I am only able to have one program accessing the INA219 sensor for reliable readings, so I have to stop my python3 test_docking program when testing the ROS2 dave node (which relies on a “battery_node” that uses the INA219 to monitor the battery).

And if that weren’t headache enough, the test_docking program is linear, but the ROS nodes are asynchronous with call backs and temporary “future callbacks” (called to tell you the result when an async service or action completes). My brain does not do multi-tasking well. I have to write a few lines of code and then test it real well, add another two lines and test - and we’re talking about a 6 hour test cycle.

If ROS wasn’t holding out this giant pickle of 3D vision for SLAM, I think I would have given up by now. ROS is just so darn complicated to program. (Surprising how you can learn “What is ROS” in an afternoon of simple tutorials, but writing real robot behaviors that put all those tutorials together is not covered in the free tutorials.)

My python program got a “fix docking failure” behavior yesterday that will improve GoPi5Go-Dave’s continued well-being:

2024-05-28 19:22|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.13v after 2.3 h charging
2024-05-28 23:07|[test_docking.py.do_playtime]---- Docking 567 : success at 0% 9.9v after 3.8 h playtime
2024-05-29 01:27|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.14v after 2.3 h charging
2024-05-29 05:12|[test_docking.py.do_playtime]---- Docking 568 : success at 0% 9.9v after 3.7 h playtime
2024-05-29 07:34|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.14v after 2.4 h charging

Docking Failures about 1 in 5 to 1 in 10 docking attempts

2024-05-29 11:18|[test_docking.py.do_playtime]Battery at 10.0v 4%, Docking: failure

Failure seems consistent when it happens, so fix is to back another 1 cm

2024-05-29 11:19|[test_docking.py.do_playtime]---- Fix Docking 569 : success at 0% 10.0v after 3.7 h playtime

Afterwards everything continues on just peachy

2024-05-29 13:39|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.13v after 2.3 h charging
2024-05-29 17:24|[test_docking.py.do_playtime]---- Docking 570 : success at 0% 9.9v after 3.7 h playtime
2024-05-29 19:44|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.13v after 2.3 h charging
2024-05-29 23:28|[test_docking.py.do_playtime]---- Docking 571 : success at 0% 10.0v after 3.7 h playtime
2 Likes

Stuff Software Just Won’t Fix

After admitting there is a problem that needs attention, my usual approach is to analyse the issue then write appropriate software to solve the problem.

GoPi5Go-Dave first logged a docking failure in April. It seemed that Dave was not driving straight off the dock, nor backing straight onto the dock. To address this issue, I created a custom version of the Dexter supplied EasyGoPiGo3.drive_cm() that incorporated a bias parameter, and determined 0.03 meters per second bias would correct the undock, and -0.01 meters per second bias would correct the docking motion.

After my intricate solution, the rate of failure dropped to about 1 in 4 attempts, with a new failure mode. Dave would back straight but stop backing about 1 cm short of the proper docking position. I introduced another “software fix” that simply backed an additional 1cm after a failure to dock was detected.

While these two software fixes allowed Dave to reliably dock, one out of every 4 attempts was actually a fixed failure.

Quickly getting down on the floor to take a good look after Dave announced “Battery at 9.9 volts. Docking now”, I watched him in action, backing onto his dock. I immediately saw the reason Dave was not driving straight, and a possible explanation for sometimes needing the extra 1 cm fix.

My feeble attempts to bevel the edge of the dock guide were uneven and excessively steep.

This time the issue seemed to need “a firm smashing of the foam”

Indeed no software fix required since!

2024-06-07 10:42|[test_docking.py.do_playtime]Battery at 10.0v 4%, Docking: failure
2024-06-07 10:42|[test_docking.py.do_playtime]---- Fix Docking 604 : success at 0% 10.0v after 3.5 h playtime
2024-06-07 11:15|[logMaintenance.py.main]** Squashed edge of dock guide more **   <<<--- PHYSICAL FIX
2024-06-07 13:05|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.14v after 2.4 h charging
2024-06-07 16:40|[test_docking.py.do_playtime]---- Docking 605 : success at 0% 9.9v after 3.6 h playtime
2024-06-07 19:00|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.12v after 2.3 h charging
2024-06-07 22:30|[test_docking.py.do_playtime]---- Docking 606 : success at 0% 9.9v after 3.5 h playtime
2024-06-08 00:48|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.12v after 2.3 h charging
2024-06-08 04:18|[test_docking.py.do_playtime]---- Docking 607 : success at 0% 9.9v after 3.5 h playtime
2024-06-08 06:36|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.10v after 2.3 h charging
2024-06-08 10:05|[test_docking.py.do_playtime]---- Docking 608 : success at 0% 10.0v after 3.5 h playtime
2024-06-08 12:23|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.12v after 2.3 h charging
2024-06-08 15:53|[test_docking.py.do_playtime]---- Docking 609 : success at 0% 9.9v after 3.5 h playtime
2024-06-08 18:12|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.11v after 2.3 h charging
2024-06-08 21:42|[test_docking.py.do_playtime]---- Docking 610 : success at 0% 10.0v after 3.5 h playtime
2024-06-09 00:02|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.12v after 2.3 h charging
2024-06-09 03:30|[test_docking.py.do_playtime]---- Docking 611 : success at 0% 10.0v after 3.5 h playtime
2024-06-09 05:44|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.12v after 2.2 h charging
2024-06-09 09:13|[test_docking.py.do_playtime]---- Docking 612 : success at 0% 10.0v after 3.5 h playtime
2024-06-09 11:34|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.12v after 2.3 h charging
2024-06-09 15:06|[test_docking.py.do_playtime]---- Docking 613 : success at 0% 9.9v after 3.5 h playtime
2024-06-09 17:28|[test_docking.py.do_charging]---- Undocking at Charge Current 175 mA 12.12v after 2.4 h charging
2024-06-09 20:58|[test_docking.py.do_playtime]---- Docking 614 : success at 0% 9.9v after 3.5 h playtime

This is a very welcome time for this successful “fix”. To date, Dave has docked 217 times under the control of a single linear Python script (test_docking.py) that directly accessed the INA219 current sensor, and directly commanded the motors.

I have been building Dave’s ROS 2 nodes in the asynchronous, client-server manner of ROS:

  • GoPiGo3 node publishes all about the platform and offers services for motors, (and servos)
  • Battery node accesses the INA219 sensor and publishes current and voltage
  • Docking node that offers two asynchronous services - Dock and Undock
  • Say Node that offers a text-to-speech service - Speak
  • Odometer Node that listens for changes in Dave’s /encoder messages and logs all motion

and the Dave Node that puts it all together:

  • Monitor battery topics till current below “battery full”
  • Request Undock Service
  • Handle Undock Service result (asynchronous message)
  • Serialize “current state” to json file
    • docked/undocked
    • charging/discharging
    • last_docking time, docking count, with success/failure
    • last_dismount time
  • Monitor battery voltage during “playtime”
  • Request Dock service when battery voltage drops below 10v
  • Handle Dock service result
  • (Wait a little for charging to start if docking is a true success)
  • Evaluate if docking was success/failure

Simply breaking the linear Python script “test_docking.py” into multiple asynchronous nodes is complication enough but then I discovered a secret about ROS that doesn’t fully sink in when learning how to build a ROS node - ROS nodes are not multi-tasking by default.

What this means is when Dave gets the “Dock Service Complete” message via his asynchronous future_dock_service_callback() (interrupt handler) he cannot know if the Battery is announcing that charging has started, because that would require interrupting the dock service interrupt.

Of course, ROS allows multi-processing execution if you learn how to set it all up and how to “spin the executor”.

I think Dave will probably dock another 200 times using the simple test_docking script before I am ready to turn his “life” over to ROS. Only then will I be able to move on to programming Dave to use the LIDAR and Camera nodes to wander and return to his dock.

I can’t wait till I can actually use some ROS packages that I didn’t have to create!

3 Likes

ROS beyond the examples - Painful Success Today

I managed to get my ROS 2 “test_dock” node to successfully command Dave to undock and to dock, with the correct is_docked and is_charging status updates.

I posted a question on robotics.stackexchange about what it took:

2 Likes

One word:
:man_facepalming:

2 Likes

pretty cool - got an very polite answer: check future.done() and when True get the service result with future.result().

I’m such a ROS NOOB … RTFM right here

2 Likes

. . .and if I had $20 for each time that happened to me, my robots would be part of “The GoPiGo National Laboratory For Robotics Research” with a dedicated staff, (and permeantly funded fellowships for the two of you!), located somewhere nice, with unlimited internet, access to the latest technology, and a beach nearby (and servants to yell at) to keep Svetlana happy.
:wink: !

2 Likes

Dave is really on a roll! Well forward 17cm and backward 17.4cm that is. Fifty Times in 12 days with no human assistance.

Need to get back to converting the docking test script to ROS, but having too much fun refreshing my 50 year old amateur radio skills at the moment.

2 Likes

Here is the just released “ROS 2 Jazzy Docking Server” in action:

2 Likes