R3-ia controller
is there a command to convert position register from Cartesian to Joint?
convert position register to Joint angles
- CPU_Malfunction
- Thread is marked as Resolved.
-
-
Manually? TP? Karel?
-
via TP program
-
Do you need that cartesian representation anywhere else, or you just want to have the joint representation regardless?
If the latter, you can just use this code to initialize a posreg in JOINT representation:
in this case, you get a PR which stores joint coordinates and holds 0 for each of them. Any operation on the coordinates will refer to joints, until you change the type of the PR.
For example, if you want to store a position in the PR in JOINT and then change one of its coordinates and move to the new position, you write sth like this:
This will initialize the PR[1] as described above, write the position stored in the P[1] to PR[1], add 60 degrees to the J6's coordinate and then move the robot to that new position stored in PR[1]. The effect will be moving the robot to P1 with +60deg difference in J6.
If you use the P[1] directly before the coordinate change operation, you can also do it like this:
This will first move the robot to P[1] (FINE is very important here!!!), store the current position of the robot as joints to PR[1], add 60deg to J6's position and then move the robot to that new position. The effect will be a movement to P[1] and then a J6 rotation by exactly +60deg.
-
What I would like to do is take a position that was captured already in Cartesian and then convert that PR to joint angles example:
PR[1]=LPOS
convert LPOS to JPOSI do realize that you can just read the position directly in the Joint angle format by using
PR[1]=JPOSbut I would like to convert the position possible when the robot is not physically at that position
Thanks
-
-
I gave this a try, and it turns PR[1] into Cartesian representation.
-
Then I guess the fastest way is writing a simple KAREL program, as KAREL has a dedicated functions for converting JOINT to XYZWPR and the other way around. It could use an argument to specify which PR you want to convert...
-
Then I guess the fastest way is writing a simple KAREL program, as KAREL has a dedicated functions for converting JOINT to XYZWPR and the other way around. It could use an argument to specify which PR you want to convert...
I found that Karel will convert without the dedicated functions. You can do something like this and it will work:
-
Takes more lines of code than using a built-in I think But still worth knowing!
-
When you get the current location, just get both.
PR[1]=JPOS
PR[2]=LPOS
Then just use them as needed.