You can iterate through the AGV's kinematics until you find the one that is currently active based on the start and end times of the kinematics.
You then further compare the current model time to the timespans the AGV spends accelerating in that kinematic. If you find that the AGV is currently accelerating, you can get the used acceleration value from the kinematic as well.
double curAccel = 0;
Object agvObj = Model.find("TaskExecuter1"); // As an example
AGV agv = AGV(agvObj);
treenode kinematics = agv.kinematics;
int rank = 1;
int numKinematics = getkinematics(kinematics, KINEMATIC_NR);
while(rank <= numKinematics)
{
double kinEndTime = getkinematics(kinematics, KINEMATIC_ENDTIME, rank);
double kinStartTime = getkinematics(kinematics, KINEMATIC_STARTTIME, rank);
if(kinEndTime >= Model.time && kinStartTime <= Model.time)
{
double accTime1 = getkinematics(kinematics, KINEMATIC_ACC1TIME, rank);
if(Model.time < kinStartTime + accTime1)
{
curAccel = getkinematics(kinematics, KINEMATIC_ACC1, rank);
break;
}
double accTime2 = getkinematics(kinematics, KINEMATIC_ACC2TIME, rank);
if(Model.time > kinEndTime - accTime2)
{
curAccel = getkinematics(kinematics, KINEMATIC_ACC2, rank);
break;
}
}
rank++;
}
return curAccel;