{"id":18981956,"url":"https://github.com/multipedrobotics/multiped","last_synced_at":"2025-04-19T20:04:14.647Z","repository":{"id":57459210,"uuid":"96718937","full_name":"MultipedRobotics/multiped","owner":"MultipedRobotics","description":"Low level driver for a quadruped robot using either AX-12A or XL-320 servos","archived":false,"fork":false,"pushed_at":"2021-01-20T23:02:06.000Z","size":133159,"stargazers_count":14,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-07T18:19:07.213Z","etag":null,"topics":["ax-12a","python2","python3","quadruped","robot","xl-320"],"latest_commit_sha":null,"homepage":"https://pypi.python.org/pypi/quadruped","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MultipedRobotics.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-10T00:06:03.000Z","updated_at":"2023-08-30T08:59:23.000Z","dependencies_parsed_at":"2022-08-27T21:01:42.210Z","dependency_job_id":null,"html_url":"https://github.com/MultipedRobotics/multiped","commit_stats":null,"previous_names":["momsfriendlyrobotcompany/quadruped"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MultipedRobotics%2Fmultiped","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MultipedRobotics%2Fmultiped/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MultipedRobotics%2Fmultiped/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MultipedRobotics%2Fmultiped/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MultipedRobotics","download_url":"https://codeload.github.com/MultipedRobotics/multiped/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223713577,"owners_count":17190498,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ax-12a","python2","python3","quadruped","robot","xl-320"],"created_at":"2024-11-08T16:11:54.100Z","updated_at":"2024-11-08T16:11:54.245Z","avatar_url":"https://github.com/MultipedRobotics.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Multiped\n\n[![](https://img.shields.io/pypi/v/quadruped.svg)](https://github.com/MultipedRobotics/multiped)\n[![](https://img.shields.io/pypi/l/quadruped.svg)](https://github.com/MultipedRobotics/multiped)\n\n**Still Under Development**\n\nMy walking robot software.\n\nNature loves animals/insects with legs. Even birds have legs! Legs allow for easier\nnavigation across rough terrain. The more legs you have, the more redundant and\nrobust you are. If you are a centipede and you break a few legs, no big deal.\nHowever, if you are a human and break one leg, then walking (forget running)\nbecomes extremely difficult.\n\nIn robotics you see many different types of walking robots. Common ones are:\n2 legs, four legs, and 6 legs. There are advantages and disadvantages for each\nof these types of robots.\n\n- 2 legs\n    - balancing and shifting the body's center of mass is critical to the\nrobot not falling over\n    - the 2 legs are generally need to be more powerful to lift the body mass\n- 4 legs:\n    - there is an inherent stability with this configuration. You only need 3\n    legs (tripod) to keep the robot standing, leaving one leg to move freely\n    as needed\n    - each of the legs can be weaker than its 2 legged counter part\n    - However, there is still a lot of motors, data lines, coordination complexity\n    than if you only had 2 legs\n- 6 (or more) legs:\n    - having more than 4 legs contains all of the same advantages/disadvantages\n    of 4 legs\n    - you also have more redundancy, essentially able to loose 2 legs and keep\n    walking\n    - there are also more types of gaits available to you, which is a fancy word\n    for how you control your leg moves when walking, trotting, running, etc\n    - You can even use some of your lets as arms to move objects around while still\n    maintaining a stable tripod stance\n    - However, more motors, more weight, more power consumption drives you to needing\n    larger and more expensive batteries\n    - at some point (maybe a centipede) more legs doesn't really add any advantage\n\n[Robot based on Robotis XL320 Servos](https://github.com/MultipedRobotics/quadruped-XL320):\n\n* [YouTube](https://www.youtube.com/watch?v=kH2hlxUfCNg)\n* [Vimeo](https://player.vimeo.com/video/194676675)\n\n[Robot based on Robotis AX12 Servos](https://github.com/MultipedRobotics/quadruped-AX12)\n\n* Not fully working yet\n\n## Required Software\n\nThis software requires [`pyservos`](https://github.com/MomsFriendlyRobotCompany/pyservos)\nto run. This software talks to both the XL-320 and AX-12A servos from Robotis.\n\n# Class Layout\n\n![](pics/quad-movement.png)\n\nHere is *sort* of the layout of the code:\n\n```\n      cmd      3d pts      DH angles        servo packet\nrobot --\u003e gait -----\u003e legs --------\u003e engine -----------\u003e servos\n```\n\n- **Robot(data):**\n    - Holds all of the other classes: Kinematics, Gait, Engine\n    - Holds all sensors\n    - Runs any logic/AI for the robot\n- **Gait:**\n    - Gait calculates the foot positions for 1 cycle of a movement\n        - All values are in (x,y,z) of units mm\n    - command() - plans all feet through 1 gait cycle (say 15 steps)\n- **Engine:**\n    - Engine takes the output from kinematics and translates it to servo space\n      for each time stop and each leg in the cycle. It then sends the commands\n      (in bulk) to move the servos each step\n      - legs[4]\n          - servos[3-4]\n              - current angle\n              - ID\n              - angle offset (based on kinematics to align with DH reference frame)\n- **Kinematics:**\n    Takes the 3d positions from gait and performs the inverse kinematics\n    - leg parts: coxa, femur, tibia, *[tarsus]*\n    - *forward()* - forward kinematics\n    - *inverse()* - inverse kinematics\n\nThe example quadruped (in the examples folder), takes a dictionary (or you can\nuse a json file). Currently it takes:\n\n```json\ndata = {\n    \"numLegs\": 4,\n    \"numServosPerLeg\": 4,\n    \"coxa\":   [52, 150],\n    \"femur\":  [90, 123],\n    \"tibia\":  [89, 194],\n    \"tarsus\": [90, 167],\n\n    \"sit\": [80, 0, 1],\n    \"stand\": [120, 0, -70],\n\n    \"servoType\": 1,\n    \"bcm_pin\": 11,\n    \"serialPort\": \"/dev/tty.usbserial-AL034G2K\"\n}\n```\n\nIf you don't pass it a serial port, then it falls back to a simulated serial\nport which does nothing but is useful for testing.\n\n## Bulk Writing\n\nNormally, you would send an individual command to each servo and get a response\nback from it. That creates a lot of back an forth communications. Instead,\nthis library uses a bulk write to send commands to all servos at once with no reply.\nThis results in smoother motion and greatly reduced data transmission.\n\n## Building and Documentation\n\nDetails for how to build the robot and other information are in the `docs` folder\nin the [git repo](https://github.com/MultipedRobotics/multiped/tree/master/docs)\n\n# Tools\n\nThis directory contains several tools for the robot:\n\n- get_leg_angles.py: prints out the joint angles for all 4 legs\n\n```bash\n$ ./get_leg_angles.py /dev/tty.usbserial-AL034G2K\nOpened /dev/tty.usbserial-AL034G2K @ 1000000\n\nServos: 1 - 12\nAll angles are in degrees\n         Leg 1 |         Leg 2 |         Leg 3 |         Leg 4 |\n   ID | Angle  |   ID | Angle  |   ID | Angle  |   ID | Angle  |\n-----------------------------------------------------------------\n    1 | 149.56 |    4 | 149.56 |    7 | 149.56 |   10 | 149.56\n    2 | 239.88 |    5 | 271.55 |    8 | 269.79 |   11 | 270.38\n    3 |  99.41 |    6 | 100.29 |    9 | 100.00 |   12 |  99.41\n-----------------------------------------------------------------\n```\n\n- get_leg_info.py: prints out servo information for all 12 servos on the robot\n\n\n```bash\n$ ./get_leg_info.py /dev/tty.usbserial-AL034G2K\nOpened /dev/tty.usbserial-AL034G2K @ 1000000\n\nServos: 1 - 12\n--------------------------------------------------\nServo: 1          HW Error: 0\nPosition [deg]: 149.6  Load:   0.0% CCW\nVoltage [V]  7.0     Temperature [F]:  80.6\n--------------------------------------------------\nServo: 2          HW Error: 0\nPosition [deg]: 239.6  Load:   0.0% CCW\nVoltage [V]  7.2     Temperature [F]:  80.6\n--------------------------------------------------\nServo: 3          HW Error: 0\nPosition [deg]:  99.4  Load:   0.0% CCW\nVoltage [V]  7.2     Temperature [F]:  82.4\n--------------------------------------------------\nServo: 4          HW Error: 0\nPosition [deg]: 149.6  Load:   0.0% CCW\nVoltage [V]  7.3     Temperature [F]:  80.6\n--------------------------------------------------\nServo: 5          HW Error: 0\nPosition [deg]: 271.6  Load:   0.0% CCW\nVoltage [V]  7.2     Temperature [F]:  80.6\n--------------------------------------------------\nServo: 6          HW Error: 0\nPosition [deg]: 100.3  Load:   0.0% CCW\nVoltage [V]  7.4     Temperature [F]:  82.4\n--------------------------------------------------\nServo: 7          HW Error: 0\nPosition [deg]: 149.6  Load:   0.0% CCW\nVoltage [V]  7.2     Temperature [F]:  80.6\n--------------------------------------------------\nServo: 8          HW Error: 0\nPosition [deg]: 269.8  Load:   0.0% CCW\nVoltage [V]  7.1     Temperature [F]:  78.8\n--------------------------------------------------\nServo: 9          HW Error: 0\nPosition [deg]:  99.4  Load:   0.8% CCW\nVoltage [V]  7.2     Temperature [F]:  82.4\n--------------------------------------------------\nServo: 10          HW Error: 0\nPosition [deg]: 149.9  Load:   0.0% CCW\nVoltage [V]  7.1     Temperature [F]:  80.6\n--------------------------------------------------\nServo: 11          HW Error: 0\nPosition [deg]: 270.1  Load:   0.0% CCW\nVoltage [V]  7.2     Temperature [F]:  80.6\n--------------------------------------------------\nServo: 12          HW Error: 0\nPosition [deg]:  99.4  Load:   0.0% CCW\nVoltage [V]  7.1     Temperature [F]:  84.2\n--------------------------------------------------\n```\n\n## History\n\n### RC Servos\n\n\u003cimg src=\"pics/rc-spider.jpg\" width=\"400px\"\u003e\n\nThis was the original version, shown above around Aug 2016. It used toy RC\nservos (9 g's), they didn't work that great. I think I lost the code, because\nI can't find it.\n\n### XL-320 Servos\n\n\u003cimg src=\"pics/xl-320-spider.jpg\" width=\"400px\"\u003e\n\n**work on this robot has stopped** This worked OK, see the movie above.\nThe servos were not very strong and the lego like rivets were kind of\na pain to use. The rivets also didn't hold things together very tight\nso there was a lot of wiggle. Overall, I prefer nuts/bolts.\n\n### AX-12A Servos\n\n\u003cimg src=\"pics/ax-12a-spider.jpg\" width=\"400px\"\u003e\n\n**this is the current robot I am focusing on** All of the current code\nis designed for this robot. I *sort of* maintain backwards compatability\nwith the XL-320, but I don't guarentee it.\n\n\n# ToDo\n\n- change more return values to `tuples` instead of `lists` for performance\n- do CM shifting\n- make generic, so I can do 6 or 8 legs\n- flush out the config file better, I have hard coded too many things\n\n# Change Log\n\n| Date | Version | Notes |\n|---|---|---|\n| 2018-11-27 | 0.6.0 | Reorg'd, moved robots to own repo |\n| 2017-12-25 | 0.5.0 | Clean up and reorg, removed unnecessary libraries |\n| 2017-06-07 | 0.4.1 | broke out into package and published to PyPi |\n| 2016-08-10 | 0.0.1 | init |\n\n\n# MIT Software License\n\n**Copyright (c) 2016 Kevin J. Walchko**\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultipedrobotics%2Fmultiped","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmultipedrobotics%2Fmultiped","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultipedrobotics%2Fmultiped/lists"}