Best Practices: Difference between revisions

No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1:
This page is dedicated to listing some good practices to do or helpful things to set up for programming.
[[File:32007-10619525.jpg|frame|right|Adhering to good practices will make programming the robots quicker, diagnostics easier, and allow others to understand your programs better.|alt=|thumb|300x300px]]
 
=== Position Registers ===
Line 7:
 
 
[[File:Homeposition.jpg|frame|right|This is the robot in our "Home" position|alt=|thumb|300x300px]]
 
The most common universal position stored in position registers is the "Home" position. For our robots, we set the joint positions to zeros except for joint 5, which faces down. This means the tool can be moved in world frame XYZ after taking it to home, with no angles or error in Z motion. on a XY plane work area (the bed)
 
==== Zeroing ====
Position registers are often zeroed in the beginning of programs to initialize them as a predictable value. If a program uses values from a position register that isn't within the acceptable range to start, unintended events could occur.
 
This can be done with a single register instruction, as follows:
In our robot lab, we like to initialize PR[2] as containing 0,0,0,0,0,0. This allows us to set any position register we want as "zero" with a single instruction.
 
'''PR[5]=PR[5]-PR[5]'''
We also commented PR[2] as "Zero" so it shows up as PR[2:Zero] which helps in remembering what lines do in larger programs.
 
=== Digital Inputs ===
Example:
 
* It is best to cluster your individual digital inputs and outputs on one side of whatever range you are using. This makes it easy to set up a [[I/O#Group I.2FO|group input]] without having to change any existing inputs.
PR[6:HeightOffset] = PR[2:Zero]
 
 
=== Digital Inputs ===
 
* Any group of inputs can become an analog input, given an ADC.
 
==Files and File Systems==
This section briefly details files. For more information, see [[File Manipulation]].
<br />
=== Backups ===