- Posts: 29
- Thank you received: 0
genserkins.c / gensrkins.h - and question about JOINTS
6 years 7 months ago #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 :laugh: :laugh: .
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 :laugh: :laugh: .
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 to join the conversation.
6 years 7 months ago #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 to join the conversation.
6 years 7 months ago #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:
Code:
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:
Code:
#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 to join the conversation.
6 years 7 months ago #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 to join the conversation.
Time to create page: 0.084 seconds
