Actual position and Commanded position differ, using cia402

  • low-blip
  • Away
  • New Member
  • New Member
More
19 May 2025 14:01 - 19 May 2025 14:22 #328745 by low-blip
I checked the userkins.comp file, found nothing strange, but in userkins.c, it was

int kinematicsForward ...
   ...
    pos->tran.x = j[0]/80; // X coordinate
    pos->tran.y = j[1]/80; // Y coordinate
    pos->tran.z = j[2]/80; // Z coordinate

while in userkins.comp or either of the kinematicsInverse functions, the /80 was not there. I tried compiling again, nothing changed. I tried deleting the /80 from userkins.c, everything is now working. I just have no idea why..
Last edit: 19 May 2025 14:22 by low-blip.
The following user(s) said Thank You: Hakan

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

  • langdons
  • Away
  • Platinum Member
  • Platinum Member
More
20 May 2025 00:10 #328763 by langdons
Weird.

Often with programming, huge problems are caused by like 3 wrong characters.

Perhaps it was some temporary fix that was not removed as it should have been?

C is a good language, better than Python IMO.

(Python always complains about not converting tabs to spaces, which I despise)

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

  • low-blip
  • Away
  • New Member
  • New Member
More
20 May 2025 08:18 #328787 by low-blip
Could be, but I can't figure out where it's coming from, so looks like I'm stuck with a temporary fix of a possible temporary fix for now.

I remember Python giving me so much grief over the tabs and spaces in my first year of learning to program! At least these days IDEs take care of that problem.

C just went completely over my head when I tried to learn it. I can mostly read it but I cannot write anything in C, it's pretty frustrating

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

More
20 May 2025 08:45 #328789 by Aciera
Sounds like a problem compiling the .comp file as the 'halcompile' tool would not add or remove anything in those lines.
Impossible to say without actually seeing your userkins.comp file.
The following user(s) said Thank You: low-blip

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

  • low-blip
  • Away
  • New Member
  • New Member
More
20 May 2025 09:17 #328790 by low-blip
Oh thanks! you're right that halcompile is having some problem, userkins.c is unchanged after I run
sudo halcompile --install userkins.comp
. There's nothing in the terminal that hints at it not working.

Compiling realtime userkins.c
Linking userkins.so
cp userkins.so /usr/lib/linuxcnc/modules/


I've attached the userkins.comp file here
Attachments:

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

More
20 May 2025 11:38 #328799 by Aciera
I think you are being confused by an old version of 'userkins.c'. Note that
sudo halcompile --install userkins.comp

will not create a 'userkins.c' file at all, it will directly create a 'userkins.so' and copy that to the appropriate folder.

linuxcnc.org/docs/html/man/man1/halcompile.1.html

If things are working after
'sudo halcompile --install userkins.comp'
then you can delete the 'userkins.c' file.
The following user(s) said Thank You: low-blip

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

More
20 May 2025 11:41 #328800 by andypugh
I don't know why there is a 22.2222 factor on your rotary axes, it feels like that constant factor could be in the INI scaling.

In fact your userkins appears to basically be a trivial kinematics? Why not use trivkins?

Maybe you are running a run-in-place system, so LinuxCNC is running from linuxcnc-dev but halcompile is placing the compiled kins in the root structure?
(But that wouldn't explain why edirting the C and recompiling works...)
The following user(s) said Thank You: low-blip

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

  • langdons
  • Away
  • Platinum Member
  • Platinum Member
More
20 May 2025 13:53 #328812 by langdons
C isn't so hard, try it!

It's a nice, simple language.

Try out Arduino, it'll teach you to be a C master.

You'll start to end sentences with a ";" after while!

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

  • low-blip
  • Away
  • New Member
  • New Member
More
20 May 2025 15:51 #328815 by low-blip
I am so confused. the setup does still works after I deleted userkins.c, so the problem must have come from the old userkins.so. According to our git history, userkins.comp never changed, and we did run halcompile when we set up the project, so I don't see why userkins.so changed. Not important, maybe someone accidentally copied an older version from somewhere.

As for the other issues with userkins, I don't know, this is how I received the configuration. I'm slowly trying to figure things out.
 

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

  • low-blip
  • Away
  • New Member
  • New Member
More
20 May 2025 16:00 #328816 by low-blip
I've learned C for a semester in university, didn't get it at all. It was so not nice to me.

I do program Arduinoes these days, because the other colleagues don't want to, but isn't that C++? Any way I hate it too :)

When I need C I use Rust instead, it's a pain too but at least I can usually figure out where I made a mistake. Which is usually forgetting the ';'

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

Time to create page: 0.098 seconds
Powered by Kunena Forum