Getting joint position with javascript

which port i should use to get joints position in javascript using get_joint_position()? Thanks.

You’re potentially asking 2 things there. Do you want to get the joint positions using the Java API, or are you trying to run a URScript command and have it return the result back to Java?

Hi, thanks for the answer! Is there any javascript API where i can ask and get the joint position? The question was that if i can get joint position running a script in javascript using URScript command.
Something like getting the connection and asking for the position continuosuly.
Thanks!!

OK… This isn’t me trying to be pedantic here, just that precision of language is important. Javascript is not the same as Java. So I’m going to assume you mean just straight Java (what URCAPs are written in) and that you aren’t trying to run some javascript hosted on some webserver or something.

Regardless, you’ve further defined the scope of your question, which makes it somewhat of a moot point, since you want to read the joint positions CONTINUOUSLY, as opposed to capturing them at a single moment in time (like at the time of pushing a button on the UI). There is no built-in API command for this in Java. You would have to write in a Python (or similar) daemon and implement the Realtime Data Exchange (RTDE) to poll that sort of data constantly. There are resources on UR’s website with examples on how to go about doing that, but it’s not a trivial process.

Sorry for the missunderstanding, i meant javascript implementing a RTDE. I 've read the UR’s website and manual, but i cannot access to that info from the robot when asking it from the code. I’m using 30003 port, but when i ask for the position using the function declared, it doesnt exist.