IEEERobotics / high-level

CV, localization, mapping, planning, and generally anything that will run on the PandaBoard
BSD 2-Clause "Simplified" License
2 stars 1 forks source link

Rounding between comm/nav/loc causing problems #30

Open dfarrell07 opened 11 years ago

dfarrell07 commented 11 years ago

In short, comm only works in integer values of mm and nav rounds to hundredths of inches, which ends up causing enough precision loss to be problematic. I either need to increase the acceptable error in nav or @jschornick and @napratin need to lose less data when rounding.

Here's a log result that shows what's going on.

2013-04-02 13:31:30,859 | INFO | nav.py | communicateSol | 337 | Movement will be in XY plane
2013-04-02 13:31:30,860 | DEBUG | nav.py | XYFrombot_locUC | 475 | XYFrombot_locUC translated 11.7348558715 to 0.298065339137
2013-04-02 13:31:30,861 | DEBUG | nav.py | XYFrombot_locUC | 475 | XYFrombot_locUC translated 13.1837273603 to 0.334866674952
2013-04-02 13:31:30,861 | INFO | nav.py | communicateSol | 342 | Next step of solution is to move 0.0146312960263 meters in the XY plane
2013-04-02 13:31:30,862 | DEBUG | nav.py | distToCommUC | 399 | Translated XY move command from 0.0146312960263 to 14.6312960263
2013-04-02 13:31:30,862 | INFO | nav.py | distToCommUC | 403 | Bot loc is now marked as dirty
2013-04-02 13:31:30,866 | DEBUG | nav.py | distFromCommUC | 429 | Translated XY commResult from 14 to 0.014
2013-04-02 13:31:30,866 | INFO | nav.py | communicateSol | 346 | Comm returned XY movement feedback of 0.014
2013-04-02 13:31:30,867 | DEBUG | nav.py | getSensorData | 516 | Polling sensors...
2013-04-02 13:31:30,870 | INFO | nav.py | getSensorData | 533 | Sensor data was fake, building realistic fake one
2013-04-02 13:31:30,872 | INFO | nav.py | getSensorData | 540 | Sensor data from comm: {'accel': {'x': 0, 'y': 0, 'z': 980},
 'heading': 0,
 'id': 0,
 'msg': 'This is fake',
 'result': True,
 'ultrasonic': {'back': 100, 'front': 100, 'left': 100, 'right': 100}}
2013-04-02 13:31:30,873 | INFO | nav.py | getSensorData | 544 | Converted sensor data: {'accel': {'x': 0, 'y': 0, 'z': 980},
 'heading': 0.0,
 'id': 0,
 'msg': 'This is fake',
 'result': True,
 'ultrasonic': {'back': 1.3385833999999999,
                'front': 1.3385833999999999,
                'left': 1.3385833999999999,
                'right': 1.3385833999999999}}
2013-04-02 13:31:30,874 | DEBUG | nav.py | communicateSol | 376 | Waiting for localizer to read commResult and set bot_loc[dirty] to False
2013-04-02 13:31:30,874 | DEBUG | localizer.py | run | 50 | From qNav: Turn: +0.00, Move: 0.55
2013-04-02 13:31:30,874 | DEBUG | localizer.py | run | 51 | Sensors dict: {'accel': {'y': 0, 'x': 0, 'z': 980}, 'id': 0, 'ultrasonic': {'front': 1.3385833999999999, 'right': 1.3385833999999999, 'back': 1.3385833999999999, 'left': 1.3385833999999999}, 'result': True, 'msg': 'This is fake', 'heading': 0.0}
2013-04-02 13:31:30,875 | DEBUG | localizer.py | run | 55 | Ideal pose: (11.52, 13.69) @ +1.96
2013-04-02 13:31:30,875 | DEBUG | localizer.py | run | 58 | Guess pose: (11.52, 13.69) @ +1.96
2013-04-02 13:31:30,887 | DEBUG | nav.py | XYFrombot_locUC | 475 | XYFrombot_locUC translated 11.5239279997 to 0.292707771194
2013-04-02 13:31:30,888 | DEBUG | nav.py | XYFrombot_locUC | 475 | XYFrombot_locUC translated 13.6929523013 to 0.347800988453
2013-04-02 13:31:30,889 | DEBUG | nav.py | locsEqual | 601 | Checking if 0.301625 0.320675 1.9634954 equals 0.292707771194 0.347800988453 1.9634954
2013-04-02 13:31:30,890 | DEBUG | nav.py | locsEqual | 602 | Acceptable error is 0.0064135 for XY and 0.589048622535 for theta
2013-04-02 13:31:30,890 | INFO | nav.py | locsEqual | 614 | Locations are not equal to within the given error
2013-04-02 13:31:30,891 | WARNING | nav.py | communicateSol | 390 | Location is off from what solution dictates, need new solution
2013-04-02 13:31:30,891 | WARNING | nav.py | macroMove | 284 | Attempted move wasn't within error margins, re-computing solution and trying again
napratin commented 11 years ago

comm is only a message passer, I'm not sure if comm is doing any manipulation other than forcing angles to be int. I am currently not forcing distances to be int, that is something nav is making sure, right? (e.g. when calling botMove, botSet etc.) With floats passed in for distances, motor-control might get screwed up. Let me know if I should add int(..) casts for everything in comm.

dfarrell07 commented 11 years ago

I wasn't casting to int, but I am now for distance, speed and angle. I'll push these changes up ASAP.