is it possible to read the length of a path trajectory? such as routine trajectory_length (path[2..5] ) : REAL
How to get the length of a path trajectory in karel?
-
leoyang -
April 14, 2014 at 9:56 AM -
Thread is marked as Resolved.
-
-
I don't know of any built-in that will do what you ask, but provided the positions in your path are all Cartesian, it shouldn't be to hard to write a simple function that iterates over your PATH variable (using PATH_LEN()) and calculates the Cartesian distance between successive points.
-
thanks for your reply.
i thought the solution as your suggestion, but it's very difficult to calculate the length of space curve, it's also related to the robot speed and fly mode.
-
Hi,
see pls $SCR_GRP[1].$DPOS_DST, $SCR_GRP[1].$DST_POS_X/y/z maybe it is what are you looking for. -
Hi,
see pls $SCR_GRP[1].$DPOS_DST, $SCR_GRP[1].$DST_POS_X/y/z maybe it is what are you looking for.I believe that's just straight line distance from the TCP to the destination point. Paths in KAREL can be multiple points.
-
Quote
I believe that's just straight line distance from the TCP to the destination point. Paths in KAREL can be multiple points.
Okay, you can use : $SCR_GRP[n].$M_DST_ENB && $SCR_GRP[n].$MOVE_DST. In beginning of routine you need get current move_dst. After get first path we can count lenght.
-
thanks!
you mean the variable '$SCR_GRP[n].$MOVE_DST' can calculate the path length before program execution?
i will test later, thanks! -
see if you have many paths of moving, then in MOVE_DST we see length of moving is increment set by step but when look in DPOS_DST we got length to the next point of move. If need calculate before programe execution...i dont know how to calculate joint trajectory((( if trajectory is linear then calculate is easy.