genserkins.c / gensrkins.h - and question about JOINTS
- felixcnc
-
Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 29
- Thank you received: 0
20 Mar 2020 03:35 #160829
by felixcnc
genserkins.c / gensrkins.h - and question about JOINTS was created by felixcnc
Good evening people,
Sorry to bother you , but now that the whole country (Argentina) is locked down and quarantined it looks like I came back to my robotics project
.
I need to print out in the console the JOINT values from a PUMA560. I believe that's using genserkins, so I was checking the code and it seems my C is kind of rusty.
I was checking:
to be honest, I don't really understand how it works though.
So my question is, can someone with better understanding can point me out HOW I should print the JOINT values for the robot?
What I like to print is just all the joints something like:
printf("%lf,%lf,%lf,%lf,%lf,%lf\n", JT[0], JT[1], JT[2], JT[3], JT[4], JT[5]);
I know the code above is wrong, but that's the idea and (it's embarrassing) but I did not get how to print those. I wanted to do that inside the compute_jinv, but anywhere it's fine.
My idea is to print the 6 values all the time... (Yes, I understand I will probably make the robot REALLY slow, because that's called all the time, or very often), but I will put that into a file, run a G-CODE, and exit.
Then I will use those values to do some math stuff outside.
THANK YOU VERY MUCH.
Cheers
Félix
Sorry to bother you , but now that the whole country (Argentina) is locked down and quarantined it looks like I came back to my robotics project


I need to print out in the console the JOINT values from a PUMA560. I believe that's using genserkins, so I was checking the code and it seems my C is kind of rusty.
I was checking:
- go_matrix
- GO_MATRIX_DECLARE
to be honest, I don't really understand how it works though.
So my question is, can someone with better understanding can point me out HOW I should print the JOINT values for the robot?
What I like to print is just all the joints something like:
printf("%lf,%lf,%lf,%lf,%lf,%lf\n", JT[0], JT[1], JT[2], JT[3], JT[4], JT[5]);
I know the code above is wrong, but that's the idea and (it's embarrassing) but I did not get how to print those. I wanted to do that inside the compute_jinv, but anywhere it's fine.
My idea is to print the 6 values all the time... (Yes, I understand I will probably make the robot REALLY slow, because that's called all the time, or very often), but I will put that into a file, run a G-CODE, and exit.
Then I will use those values to do some math stuff outside.
THANK YOU VERY MUCH.
Cheers
Félix
Please Log in or Create an account to join the conversation.
- bbsr_5a
- Offline
- Platinum Member
-
Less
More
- Posts: 544
- Thank you received: 105
21 Mar 2020 12:04 #160980
by bbsr_5a
Replied by bbsr_5a on topic genserkins.c / gensrkins.h - and question about JOINTS
Hi from Corona Lockdown Germany
you cand printout from a realtime kernal to a terminal
as it riuns within nanoseconds cycles
you can write your own component that counts up like 1Mio and thne prints to a file
you cand printout from a realtime kernal to a terminal
as it riuns within nanoseconds cycles
you can write your own component that counts up like 1Mio and thne prints to a file
Please Log in or Create an account to join the conversation.
- felixcnc
-
Topic Author
- Offline
- Junior Member
-
Less
More
- Posts: 29
- Thank you received: 0
22 Mar 2020 13:34 #161101
by felixcnc
Replied by felixcnc on topic genserkins.c / gensrkins.h - and question about JOINTS
Thanks!
I finally made it by adding some debug lines in the kinematicsForward function in src/emc/kinematics/genserkins.c.
I haven't finished reading the code, so I was looking at the wrong function, because it was pretty clear:
the printf lines are mine (and the rtapi_print was already there).
The result is something like this:
Which is the format I need to put those values into the V-REP and see if I can move the PUMA560. Yeah, I now doing the %.2f will lose some accuracy, but I think it's fine for this first approach.
Cheers
Félix
I finally made it by adding some debug lines in the kinematicsForward function in src/emc/kinematics/genserkins.c.
I haven't finished reading the code, so I was looking at the wrong function, because it was pretty clear:
if (changed) {
printf("#");
for (i=0; i< 6; i++) {
j[i] = joint[i];
printf("%.2f/", joint[i] + JOINT_OFFSET[i]);
}
printf("&\n");
// rtapi_print("kinematicsForward(joints: %f %f %f %f %f %f)\n", joint[0],joint[1],joint[2],joint[3],joint[4],joint[5]);
}
the printf lines are mine (and the rtapi_print was already there).
The result is something like this:
#180.76/180.00/180.25/180.76/269.75/180.00/&
#180.75/180.00/180.25/180.75/269.75/180.00/&
#180.75/180.00/180.25/180.75/269.75/180.00/&
#180.75/180.00/180.25/180.75/269.75/180.00/&
Which is the format I need to put those values into the V-REP and see if I can move the PUMA560. Yeah, I now doing the %.2f will lose some accuracy, but I think it's fine for this first approach.
Cheers
Félix
Please Log in or Create an account to join the conversation.
- andypugh
-
- Away
- Moderator
-
Less
More
- Posts: 23411
- Thank you received: 4975
25 Mar 2020 13:31 #161428
by andypugh
Replied by andypugh on topic genserkins.c / gensrkins.h - and question about JOINTS
You should probably use rtapi_print rather than printf, as it is provided as a thread-safe version.
But I think it tends to want to print out floats in hex.
But I think it tends to want to print out floats in hex.
Please Log in or Create an account to join the conversation.
Time to create page: 0.052 seconds