docs: detailed documentation of pidog/pidog.py - #2
Merged
Conversation
Co-Authored-By: Pascal Desmet <dpwp81@outlook.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
docs/pidog.md, a documentation-only deep dive into thePidoghardware abstraction layer, in the same style as the existingdocs/action_flow.md. No code changes.Covers: module header (sudo-aware
UserHome/config_filediscovery, the numpy-2numpy_matshim), every constant (link lengths,*_DPS, PID gains,HEAD_PITCH_OFFSET, head limits),__init__'s peripheral-by-peripheral fail-soft init andthread_listregistry, the producer/consumer threading model (buffers + per-group locks +wait_*_donepolling), each worker thread, the motion primitives, the ultrasonic subsystem, audio, calibration, and the kinematics (head_rpy_to_anglegimbal blend,pose2coords,pose2legs_angle, the two-link IK,legs_angle_calculation).Notable findings recorded while cross-reading
actions_dictionary.py/preset_actions.py:_imu_threaddoesn'tcontinueafterdata == False, so it unpacks a bool →TypeError; repeated IMU failure setsself.exit_flag = True, which also kills the leg/head/tail threads. An IMU fault disables all motion.compare_versionreturnsor_v >= or_v(alwaysTrue), so the version check is a no-op — and the deadelsebranch definesnumpy_matasreturn numpy_mat(data)(infinite recursion) instead ofnp.mat(data).__init__setsleg_point_struc;set_legs()/pose2coords()uselegpoint_struc— callingpose2coords()beforeset_legs()raisesAttributeError.polar2coordreferences non-existentself.A/B/C;set_anglereferences non-existentlimit_angle/coord_temp/servo_move— both dead/broken.servo_move, head/tail pop before, sowait_head_done()/wait_tail_done()return one frame early.close()never runssignal.alarm(0)(thefinally:is commented out), leaving a 5 s alarm armed and SIGINT hijacked after it returns; the ultrasonic threads are non-daemon, so skippingclose()hangs process exit.speak()shells out tosudo killall pulseaudioon every call.legs_angle_calculationcallsPidog.coord2polar(cls, coord)— passing the class asself— which only works because that method touches class constants only; this is what letsactions_dictionary.pycompute gait frames without aPidoginstance.Link to Devin session: https://app.devin.ai/sessions/7111583235ea4084a505cf2a925fd7aa
Requested by: @PascalDesmet