Get and set group values

When we move a group, we need to set a starting position for the group and get the end position when the group 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. We have talked about group states in Chapter 9. In this section we focus on positions and velocity, because they are closely related to motion functions.

Before you use group motion functions, typically you need a starting position for a group, which is set by SetGroupPositionOffset. After a group is moved, you need to get its position to make sure the axes reach the target. The position is got by GetGroupPosition and the velocity by GetGroupVelocity. After we use these functions to set and get positions and velocity, we use RtPrintf or printf to display them. To set, get, and display data without repeating the same code, we create the functions SetGroupStartingPosition, GetAGroupPosition, and GetAGroupVelocity, so you can use them anywhere when you need it.