-
Notifications
You must be signed in to change notification settings - Fork 39
Developer Guide
The code in this repository was generally written and tested in Python 2.7.14. We have used a number of different coding styles, however in the interest of consistency, use PEP8 conventions for Python code.
When in doubt, consult the Zen of Python.
Don't worry about this section unless you're using something other than Maya to
interface this repository. The following dependencies are accessible only through
Maya; use mayapy
or handle any ImportError
as needed in your IDE.
-
FK: Forward Kinematics Refers to the use of axis angles to compute the position of the end-effector
-
IK: Inverse Kinematics Refers to the use of kinematic equations (i.e. "IK solver"), to determine the axis angles of a robot, given the position of the robot's end-effector in relation to its base frame
-
TCP: Tool Center Point Refers to the point in relation to which all robot positioning is defined. If the tool on the end of the robot is a marker, for instance, the TCP would be defined as the tip of the marker
-
Try to follow naming conventions. At time of writing, the only exceptions to this rule are the Maya-Python libraries and Maya attributes.
- Variables and functions use
snake_case
- Classes and class-like objects (i.e. namedtuple) use
CapWords
- Global variables use
UPPERCASE_WORDS
- Protected variables and functions are
_prefixed
by one underscore. - Private variables and functions are
__prefixed
by two underscores.
- Variables and functions use
-
Favor descriptive, accurate, and clear names; avoid abbreviations.
-
Do not add IDE and temp files to the global
.gitignore
. Instead, add them to a local gitignore (added to~/.gitconfig
). Alternatively, the folderextern
is ignored and may be used however you'd like. -
Make sure your code compiles before submitting pull requests or pushing to the repository. For each commit, provide a briefly rationalized changelist.
-
Never import anything using
*
! This makes it super difficult for anyone else to read, debug, and trace functionality throughout the repository. -
Favor specific exceptions over broad exceptions. Custom exceptions should be avoided and, otherwise, clearly indicate the nature of the exception.
-
Document everything! Some documentation may require a full readme (which should be placed in mimic/docs) Use inline comments for anything specific about an implementation or a single line of code. Use full docstrings for modules, classes, and functions.
-
Try to avoid use of and creation of global variables (unless you have a constant parameter at the level of a module and a really good reason).
-
Try to avoid lines that exceed 80 characters in length. Don't worry if a line breaks this rule if it must.
-
When using flags for Maya PyMel functions, use the flag's Long Name
- To avoid creating PYCs, implement this at the very top of your highest level
Python script (really helpful for unittests):
import sys sys.dont_write_bytecode = True
Autodesk Robotics Lab, 2018