Get and set values

When we move an axis, we need to set a starting position for an axis and get the end position when the axis finishes its move. These are done by set and get functions. KINGSTAR offers many of these functions that can be used to set and get a variety of parameters. In this section we focus on positions, velocity, and states, because they are closely related to motion functions.

Before you use axis motion functions, typically you need a starting position for a group, which is set by SetGroupPositionOffset. After an axis is moved, you need to know whether an axis travels the specified distance. Get functions come in handy. After we use GetAxisState, GetAxisPosition, GetAxisVelocity to get the state, position, and velocity of an axis, respectively, we use RtPrintf or printf to display it. To set a position, get, and display data without repeating the same code, we create a few functions: SetAxisStartingPosition, GetAnAxisState, GetAnAxisPosition, and GetAnAxisVelocity. You can use them anywhere when you need it.