If your task executer is already at the correct start node, you can request the distance to another object, network node, control point, etc. using the distancetotravel command:
Object te = model.find("TaskExecuter1");
Object destination = model.find("Object_NN_or_CP");
double distance = distancetotravel(te, destination);
If you are specifically using the AGV network, you don't even need to have a task executer to calculate the distance between two control points along the network; you can use cpdistance:
Object cp1 = model.find("ControlPoint281");
Object cp2 = model.find("ControlPoint94");
double distanceTo = cpdistance(cp1, cp2);
double distanceBack = cpdistance(cp2, cp1);