-
Notifications
You must be signed in to change notification settings - Fork 30
Arduino_getPosition
Chris Courson edited this page Sep 3, 2020
·
1 revision
Supported by xArm
Gets the position(s) of the specified servo(s). There are three forms.
int getPosition(int servo_id);
Gets the position of one servo specified by servo_id.
Parameters:
-
servo_id
: The ID number (1 - 6) of the servo.
Returns:
- The current position of the servo (0 - 1000).
- If the position cannot be read, it will return -1;
int getPosition(xArmServo &servo);
Gets the position of one servo specified by xArmServo servo object. The position is returned by the funtion and also stored in the servo object.
Parameters:
-
servo
: The xArmServo object specifying the servo.
Returns:
- The current position of the servo.
- The position is also stored in the xArmServo object position property.
- If the position cannot be read, it will return and store -1;
bool getPosition(xArmServo servos[], int count);
Gets the position of one or more servos specified by an array of xArmServo servo object. Success is returned by returned the funtion. Positions of each servo is stored in each servo object in the array.
Parameters:
-
servos[]
: An array of one or more xArmServo objects specifying the servos. -
count
: The number of xArmServo objects in the array.
Returns:
- False if the position cannot be read.
- The position of each servo is stored in the respective xArmServo object in the array.