Omar Posted August 25 Posted August 25 Hello there, I created an empty project on the Power PMAC IDE, and created a .c file and .h file inside the C Language/Realtime Routines folder. Here is what my file structure looks like Everything is just the default from creating an empty project, except the cappheader1.c and cappheader1.h files. my cappheader1.h file looks like this: #include "../Include/pp_proj.h" #include <stdio.h> #include <float.h> #include <signal.h> #include <stdlib.h> #include <string.h> #include <math.h> and my cappheader1.c file looks like this: #define _PPScriptMode_ #define _PP_PROJ_HDR_ #include "../Include/pp_proj.h" #include "cappheader1.h" When I build, I get this error: And a similar error happens with string.h and math.h, depending on which is being included first, but not with stdio.h, float.h or signal.h. There might be other libraries that might or might not build in this scenario, but these are just the libraries I have tried. Why does this error happen? And what do I do if I need to include those libraries in my project? Thanks in advance for your help!! Quote
MoMo Posted August 26 Posted August 26 Since usrcode runs in the real-time kernel, its efficiency requirements are very high. Therefore the use of other external libraries is not allowed. This will affect the operation of the kernel. You can use these library functions in background Linux programs. Quote
Omar Posted August 28 Author Posted August 28 Thank you so much MoMo, yes that works. But since I am trying to utilize custom servo routines, is there a way around that, by somehow utilizing C libraries, and simultaneously having files inside "Realtime Routines" folder (which I assume is the only way to utilize custom servo routines)? Cheers Quote
leandro.martins Posted August 28 Posted August 28 You can create any custom servo routine adding a new function to usrcode files. The error proof method would right click on Realtime Routines folder, then User Servo Setup. There you can assign which function within the usrcode will be executed for each motor, and also create new functions. In the IDE latest release there are a few option of exporting realtime routines, but I didn't explore that yet, so not sure if that could be useful somehow to what you are trying to achieve. Quote
MoMo Posted August 30 Posted August 30 On 8/28/2024 at 11:45 AM, Omar said: Thank you so much MoMo, yes that works. But since I am trying to utilize custom servo routines, is there a way around that, by somehow utilizing C libraries, and simultaneously having files inside "Realtime Routines" folder (which I assume is the only way to utilize custom servo routines)? Cheers You can only use the mathematical function library currently provided internally by PMAC. As for the others, you cannot use them, or you have to write these functions yourself. Generally speaking, a custom algorithm should be a very concise mathematical calculation program that does not contain any string processing or other content. Your algorithm can be verified in advance using other tools, such as matlab, and then implemented in PPMAC. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.