Created
March 22, 2017 16:42
-
-
Save nvtienanh/deed73baa52198e1d8b9dfa13ae531c0 to your computer and use it in GitHub Desktop.
Humanoid robot simulation using Python
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
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="PYTHON_MODULE" version="4"> | |
<component name="NewModuleRootManager"> | |
<content url="file://$MODULE_DIR$" /> | |
<orderEntry type="inheritedJdk" /> | |
<orderEntry type="sourceFolder" forTests="false" /> | |
</component> | |
<component name="TestRunnerService"> | |
<option name="PROJECT_TEST_RUNNER" value="Unittests" /> | |
</component> | |
</module> |
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
<component name="InspectionProjectProfileManager"> | |
<settings> | |
<option name="useProjectProfile" value="false" /> | |
<option name="USE_PROJECT_PROFILE" value="false" /> | |
<version value="1.0" /> | |
</settings> | |
</component> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6.0 (C:\Users\nvtie\AppData\Local\Programs\Python\Python36\python.exe)" project-jdk-type="Python SDK" /> | |
</project> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectModuleManager"> | |
<modules> | |
<module fileurl="file://$PROJECT_DIR$/.idea/Humanoid.iml" filepath="$PROJECT_DIR$/.idea/Humanoid.iml" /> | |
</modules> | |
</component> | |
</project> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="VcsDirectoryMappings"> | |
<mapping directory="$PROJECT_DIR$" vcs="Git" /> | |
</component> | |
</project> |
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
from uLink import uLink | |
'''(self, Name, Id, Mass, Sister, Child)''' | |
# The list of biped robot link | |
Links = [] | |
BODY = uLink('BODY', 1, 3.5, 0, 2) | |
Links.append(BODY) | |
RLEG_J0 = uLink('RLEG_J0', 2, 0.5, 8, 3) | |
Links.append(RLEG_J0) | |
RLEG_J1 = uLink('RLEG_J1', 3, 0.5, 0, 4) | |
Links.append(RLEG_J1) | |
RLEG_J2 = uLink('RLEG_J2', 4, 0.5, 0, 5) | |
Links.append(RLEG_J2) | |
RLEG_J3 = uLink('RLEG_J3', 5, 0.5, 0, 6) | |
Links.append(RLEG_J3) | |
RLEG_J4 = uLink('RLEG_J4', 6, 0.5, 0, 7) | |
Links.append(RLEG_J4) | |
RLEG_J5 = uLink('RLEG_J5', 7, 0.5, 0, 0) | |
Links.append(RLEG_J5) | |
LLEG_J0 = uLink('LLEG_J0', 8, 0.5, 0, 9) | |
Links.append(LLEG_J0) | |
LLEG_J1 = uLink('LLEG_J1', 9, 0.5, 0, 10) | |
Links.append(RLEG_J1) | |
LLEG_J2 = uLink('LLEG_J2', 10, 0.5, 0, 11) | |
Links.append(LLEG_J2) | |
LLEG_J3 = uLink('LLEG_J3', 11, 0.5, 0, 12) | |
Links.append(LLEG_J3) | |
LLEG_J4 = uLink('LLEG_J4', 12, 0.5, 0, 13) | |
Links.append(LLEG_J4) | |
LLEG_J5 = uLink('LLEG_J5', 13, 0.5, 0, 0) | |
Links.append(LLEG_J5) | |
print(len(Links)) |
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
class Robot(object): | |
"""Summary of class here. | |
Longer class information.... | |
Longer class information.... | |
Attributes: | |
likes_spam: A boolean indicating if we like SPAM or not. | |
eggs: An integer count of the eggs we have laid. | |
""" | |
def __init__(self): | |
"""Inits Robot class""" | |
self.links = [] | |
# self.CoM = 0 | |
# self.ZMP | |
def public_method(self): | |
"""Performs operation blah.""" | |
def add_link(self, link): | |
"""Adding link to robot model.""" | |
self.links.append(link) | |
def display_info(self, link): | |
"""Display robot links info.""" | |
for index in range(len(self.links)): | |
self.links[index].info |
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
class uLink(object): | |
def __init__(self, Name, Id, Mass, Sister, Child): | |
self.name = Name | |
self.id = Id | |
self.m = Mass | |
self.sister = Sister | |
self.child = Child | |
def info(self): | |
print(self.name) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment