-
Notifications
You must be signed in to change notification settings - Fork 30
Arduino_setPosition
Chris Courson edited this page Sep 3, 2020
·
1 revision
Supported by xArm
/LeArm
Sets the position(s) of the specified servo(s). Optionally returns after duration has elapsed. There are three forms.
void setPosition(int servo_id, unsigned position, unsigned duration = 1000, bool wait = false);
Sets one servo's position. Optionally specify duration and wait.
Parameters:
-
servo_id
: The ID number (1 - 6) of the servo. -
position
: The position to set the servo to. The value will be clamped to the expected range for each servo depending on mode.- xArm mode: 0 to 1000 for all servos.
- LeArm mode: 1500 to 2500 for servo 1; 500 to 2500 for servos 2 through 6.
-
duration
: (optional) The length of time in milliseconds to traverse the servo movement. By default, the duration is 1000 milliseconds. -
wait
: (optional) When true, the function will return after duration has elapsed. By default, the function will return immediately and servo movement will continue for the duration.
Returns:
- Nothing.
void setPosition(xArmServo servo, unsigned duration = 1000, bool wait = false);
Set one servo's position by xArmServo object. Optionally specify duration and wait.
Parameters:
-
servo
: The xArmServo object defining servo ID and position of the servo. -
duration
: (optional) The length of time in milliseconds (0 - 3000) to traverse the servo movement. By default, the duration is 1000 milliseconds. -
wait
: (optional) When true, the function will return after duration has elapsed. By default, the function will return immediately and servo movement will continue for the duration.
Returns:
- Nothing.
void setPosition(xArmServo servos[], int count, unsigned duration = 1000, bool wait = false);
Set one or more servos' positions by and array of xArmServo object. Optionally specify duration and wait.
Parameters:
-
servos[]
: An array of one or more xArmServo objects defining servo ID and position of each servo. -
count
: The number of servos in the servos array. -
duration
: (optional) The length of time in milliseconds (0 - 3000) to traverse the servo movement. By default, the duration is 1000 milliseconds. -
wait
: (optional) When true, the function will return after duration has elapsed. By default, the function will return immediately and servo movement will continue for the duration.
Returns:
- Nothing.