RoboDK Forum
Get trajectory path length with API or/and via short python script可打印版本

+- RoboDK Forum (//www.sinclairbody.com/forum)
+-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN)
+--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API)
+--- Thread: Get trajectory path length with API or/and via short python script (/Thread-Get-trajectory-path-length-with-API-or-and-via-short-python-script)



Get trajectory path length with API or/and via short python script-Olendo-05-30-2022

Hi guys,



I'm back with a general theoretical question.

Is it possible to directly determine the length of the trajectory (or path) of a moving TCP using the RoboDK API with a short Python script?

The background is that I want to know if the trajectory from point A to point B is shorter than the path from point A to point C (e.g. length in millimetres [mm]). Is it possible to get an output of the traveled path length with the API or using a short python script?


Greetings from Germany


Ole


RE: Get trajectory path length with API or/and via short python script-Sam-05-30-2022

Hello,

With the API, calling the prog_item.Update() will return an estimate of the distance travelled, in mm.
See//www.sinclairbody.com/doc/en/PythonAPI/robodk.html?highlight=distance#robodk.robolink.Item.Update


RE: Get trajectory path length with API or/and via short python script-Olendo-06-14-2022

(05-30-2022, 10:36 AM)Sam Wrote:Hello,

With the API, calling the prog_item.Update() will return an estimate of the distance travelled, in mm.
See//www.sinclairbody.com/doc/en/PythonAPI/robodk.html?highlight=distance#robodk.robolink.Item.Update

Thank you very much for your answer Sam, it helped me a lot. I used this code block with your help.




...

[n_instructions, program_time, program_distance, valid_ratio, readable_msg] = prog.Update()
print("Distance in [mm]: ",program_distance)
print("Time in [s]: ",program_time)
...

Works perfectly for me. Thank you!


RE: Get trajectory path length with API or/and via short python script-ABakhsh-06-15-2022

You're definitely familiar with the best coding language C++ that developers use to develop their projects and they get all their queries like "expected unqualified-id before 'if'" answered properly. Developers are finding an appropriate answer about expected unqualified-id before 'if' related to the C++ coding language.
https://codeprozone.com/code/cpp/33583/expected-unqualified-id-before-if.html