How to change robot position via generated txt file

Hello, guys,

I was wondering is it possible if someone sends me a txt. file with robot axes positions, BASE and TOOL DATA. How can I read it and import the positions state? I’m guessing some kind of python script, but I have no idea.
For example:
I get a txt file with (A1 : 90, A2: -120, A3: 133, A4: 0, A5:80, A6: 0 )
How can I import these axis joints positions inside of a simulation?

Thanks in advance,
Cheers,

Please don’t make duplicate topics about the same thing.
I can’t give you an example, but there are potentially useful tutorials in the VC academy.

Basically you just need to read the file in, parse the joint values and assign the values to the joint value properties in your robot component.

If you want your robot to actually move through those points then you could generate a robot program from them.

This tutorial covers basic file reading and parsing using Python for a different purpose:
https://academy.visualcomponents.com/lessons/import-point-cloud-with-python-api/

And here is how to generate a robot program from Python:
https://academy.visualcomponents.com/lessons/write-a-robot-program/

Yes, thank you and sorry for the duplication of the topic, I watched the tutorials and I did that, but I can’t find a way to assign a different value to TOOL_DATA and BASE_DATA and switch between tools and bases ;[

Cheers,
Thank you in advance,

These are a bit complicated due to the generic structure, but isn’t this basically what you are trying to do?

ImportCSV.zip (1.9 KB)
position.csv (214 Bytes)

Attached is a python command that imports csv file. Based on the import options, you can use the csv data either as coordinate or as joint values. Check the csv format and define your data based on that.

Extract the python command to your MyCommands folder and refer to the video to use it.

1 Like