How to find an error in own kinematics?

More
17 Jan 2014 04:28 #42889 by robottom
Hi linuxcnc experts,

I got an older industrial robot with 4 axis (angular, linear, linear, angular) and I have to create my own kinematics what is easily possible with the emc2 (I'm running the linuxcnc 8 Version because my old ThinkPad is not able to run the 10 Version). The 3 axis version is running fine already and I can work with the Robot. But I want to include the 4th axis to extend the reach of the arm.
I implemented the Forward and inverse kinematics code but there is a bug in it (getting different Forward Errors) and now I'm struggling to analyze the error.
I don't think that Debugging is easily possible but I' wondering how I can transport some Information to a trace/log or somehow can access the internal state.
Somebody gave me the hint to use the #include <syslog> but this does not seem to work (compile error already at the include command).
Can you please help me and give me a hint what to do. I'm neither an expert on linuxCNC nor on Linux itself.

Any help highly appreciated.

Many thanks, Thomas

PS: I'm using sudo comp --install kinematic.s to install my kinematics module.

Please Log in or Create an account to join the conversation.

More
17 Jan 2014 20:56 - 17 Jan 2014 20:57 #42914 by andypugh

Can you please help me and give me a hint what to do. I'm neither an expert on linuxCNC nor on Linux itself.


You probably need to remove LinuxCNC from the equation.

What I would probably do is create a test component, that has HAL pins that can be set from the command line, or linked to sliders, and that calls the kinematics functions to see what happens.

It probably makes no sense to actually use HAL either, or to make the test component run in realtime, but doing so removes a number of "ought to work, but I am not sure" issues.

Because the kinematics modules have EXPORT_SYMBOL statements in them, the functions can be called directly from other code. (this is how LinuxCNC accesses them, and the load-time symbol export rather than compile-time linking is how you get to swap between kins modules)

So, a very simple test harness might be something vaguely like:
(I am going to label this pseudocode, I may not even have the comp params in the right order)
component kinstest;
pin in float joint-in-##[4];
pin out float joint-out-##[4];
function _
;;
FUNCTION(_){
#include "kinematics.h";
double *joints[9];
EmcPose *pos;
int ret;

*joints[0] = joints-in(0);
*joints[1] = joints-in(1);
...
ret = kinematicsForward(*joints, *pos); This needs placeholders for the ff and if flags, it won't compile as-is

joints-out(0) = pos->tran.x;
...
}

Then a HAL file like this:
loadrt my_kins;
loadrt kinstest;
loadrt threads
addf kinstest thread1;
start

And then a command-line HAL session
halrun
source kinstest.hal
show pin
setp kinstest.0.join-in-00 120.2
show pin
...
Last edit: 17 Jan 2014 20:57 by andypugh.

Please Log in or Create an account to join the conversation.

More
18 Jan 2014 03:25 #42932 by robottom
Hi,

sounds like an way to do easy tests with the own kinematics or maybe I misunderstood. But I doubt that this can help me because I can do the same with a pocket calc to check the results with given inputs. I don't think that my code is incorrect but I think my calculation routines have issues. This is why I want to see how the inverse and forward kinematics is called during a normal run and causes forward errors there. Is there any other way - e.g. to create log entries during the call. Maybe log entries can harm the real time procedures but this would be only for a test.
Or is this to silly?
Would be perfect if you could give me some idea how to trace or visualize the Input and results during the run. I'm also not sure when inverse kinematics is called and when a forward kinematics is called.

Many thanks and best regards,
Thomas

Please Log in or Create an account to join the conversation.

More
18 Jan 2014 03:41 #42933 by andypugh

Is there any other way - e.g. to create log entries during the call. Maybe log entries can harm the real time procedures but this would be only for a test.


You can use rtapi_print
www.linuxcnc.org/docs/html/man/man3/rtapi_print.3rtapi.html
But that will send a _lot_ of output to dmesg.

Alternatively, create debugging HAL pins in the setup part of the kins, then write to them. (have a look at gantrykins for an example of kins-with-hal-pins)

You can log the HAL pins with halsampler / halstreamer
www.linuxcnc.org/docs/html/man/man1/halsampler.1.html

Please Log in or Create an account to join the conversation.

Time to create page: 0.268 seconds
Powered by Kunena Forum