How to control posisition of 2 Dynamixel ax12a with different degree

Servo: Dynamixel AX12a (1, 2)
Mikrokontroller: OpenRB-150
I want to learn about robotics, so I just learned to use a dynamixel servo which is said to be widely used in several projects, I have 2 servos that already have different IDs but I don’t understand how to make one of the servos move at a different angle, I only have programming example from Program control 2 dynamixel to the same degree can anyone help me to learn this? or provide some similar programming examples
I’ve tried the example from Dynamixel2Arduino and modified it a bit but the servo movement doesn’t move at the same time. Any suggestions?
here the programs:

#include <Dynamixel2Arduino.h>

// Please modify it to suit your hardware.
#if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_MEGA2560) // When using DynamixelShield
#include <SoftwareSerial.h>
SoftwareSerial soft_serial(7, 8); // DYNAMIXELShield UART RX/TX
#define DXL_SERIAL Serial
#define DEBUG_SERIAL soft_serial
const int DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
#elif defined(ARDUINO_SAM_DUE) // When using DynamixelShield
#define DXL_SERIAL Serial
#define DEBUG_SERIAL SerialUSB
const int DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
#elif defined(ARDUINO_SAM_ZERO) // When using DynamixelShield
#define DXL_SERIAL Serial1
#define DEBUG_SERIAL SerialUSB
const int DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
#elif defined(ARDUINO_OpenCM904) // When using official ROBOTIS board with DXL circuit.
#define DXL_SERIAL Serial3
#define DEBUG_SERIAL Serial
const int DXL_DIR_PIN = 22;
#elif defined(ARDUINO_OpenCR) // When using official ROBOTIS board with DXL circuit.
#define DXL_SERIAL Serial3
#define DEBUG_SERIAL Serial
const int DXL_DIR_PIN = 84; // OpenCR Board’s DIR PIN.
#elif defined(ARDUINO_OpenRB) // When using OpenRB-150
//OpenRB does not require the DIR control pin.
#define DXL_SERIAL Serial1
#define DEBUG_SERIAL Serial
const int DXL_DIR_PIN = -1;
#else // Other boards when using DynamixelShield
#define DXL_SERIAL Serial1
#define DEBUG_SERIAL Serial
const int DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
#endif

const uint8_t DXL_ID = 1;
const uint8_t DXL_ID2 = 2;
const float DXL_PROTOCOL_VERSION = 1.0;

Dynamixel2Arduino dxl(DXL_SERIAL, DXL_DIR_PIN);

//This namespace is required to use Control table item names
using namespace ControlTableItem;

void setup() {
// put your setup code here, to run once:

// Use UART port of DYNAMIXEL Shield to debug.
DEBUG_SERIAL.begin(115200);
while(!DEBUG_SERIAL);

// Set Port baudrate to 57600bps. This has to match with DYNAMIXEL baudrate.
dxl.begin(1000000);
// Set Port Protocol Version. This has to match with DYNAMIXEL protocol version.
dxl.setPortProtocolVersion(DXL_PROTOCOL_VERSION);
// Get DYNAMIXEL information
dxl.ping(DXL_ID);
dxl.ping(DXL_ID2);

// Turn off torque when configuring items in EEPROM area
dxl.torqueOff(DXL_ID);
dxl.setOperatingMode(DXL_ID, OP_POSITION);
dxl.torqueOn(DXL_ID);

dxl.torqueOff(DXL_ID2);
dxl.setOperatingMode(DXL_ID2, OP_POSITION);
dxl.torqueOn(DXL_ID2);

// Limit the maximum velocity in Position Control Mode. Use 0 for Max speed
dxl.writeControlTableItem(PROFILE_VELOCITY, DXL_ID, 30);
// Limit the maximum velocity in Position Control Mode. Use 0 for Max speed
dxl.writeControlTableItem(PROFILE_VELOCITY, DXL_ID2, 30);
}

void loop() {
// put your main code here, to run repeatedly:

// Please refer to e-Manual(DYNAMIXEL Shield) for available range of value.
// Set Goal Position in RAW value
dxl.setGoalPosition(DXL_ID, 1000);
dxl.setGoalPosition(DXL_ID2, 20);

int i_present_position = 0;
float f_present_position = 0.0;

int i_present_position2 = 0;
float f_present_position2 = 0.0;

while (abs(1000 - i_present_position) > 10)
{
i_present_position = dxl.getPresentPosition(DXL_ID);
DEBUG_SERIAL.print("Present_Position(raw) : ");
DEBUG_SERIAL.println(i_present_position);
}
delay(1000);

// Set Goal Position in DEGREE value
dxl.setGoalPosition(DXL_ID, 170, UNIT_DEGREE);

while (abs(170 - f_present_position) > 2.0)
{
f_present_position = dxl.getPresentPosition(DXL_ID, UNIT_DEGREE);
DEBUG_SERIAL.print("Present_Position(degree) : ");
DEBUG_SERIAL.println(f_present_position);
}
delay(1000);

//SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS//
while (abs(20 - i_present_position2) > 10)
{
i_present_position2 = dxl.getPresentPosition(DXL_ID2);
DEBUG_SERIAL.print("Present_Position(raw) : ");
DEBUG_SERIAL.println(i_present_position2);
}
delay(1000);

// Set Goal Position in DEGREE value
dxl.setGoalPosition(DXL_ID2, 120, UNIT_DEGREE);

while (abs(120 - f_present_position2) > 2.0)
{
f_present_position2 = dxl.getPresentPosition(DXL_ID2, UNIT_DEGREE);
DEBUG_SERIAL.print("Present_Position(degree) : ");
DEBUG_SERIAL.println(f_present_position2);
}
}

In order to get the servos to move at the same time I’d recommend using the Sync Write example instead. The position mode example you are using here sends the two commands at different times, so you won’t really be able to get simultaneous movement.

If you are going to use SyncWrite for AX-12, you can also use the example code I wrote for XL-320s at this post:

There are two programming differences between XL-320 and AX-12 which are:

  1. The Present Position Address on the AX-12A is 36, while it is 37 on the XL-320.

  2. The AX-12A does not have a P Gain Parameter.

Make sure you read and understand the Control Tables of XL-320 and AX-12