dennisg Posted July 10, 2012 Share Posted July 10, 2012 I am trying to write/use my first user written servo routine. I am following the instructions given starting on page 493 of the users manual. I compile and download using the "Build and download all programs" selection, this appears to work. Then I go into Realtime Routines User Servo Setup after right clicking the selection. In the dropdown I see my user_pid_ctrl as an available selection, and I chose that as User Servo 1. When I hit "apply" I get a popup window that says "Please BUILD and DOWNLOAD the project for the User Servo Setup Changes to take effect". I am apparently missing a step here but unsure what that is. Actually I am not totally sure that usercode.c is even being compiled because I put a typo in it to see if it would error on the build and it does not. All I see in the status window is that capp1.c built. Link to comment Share on other sites More sharing options...
Sina.Sattari Posted July 10, 2012 Share Posted July 10, 2012 dennisg, You need to assign your user-written servo algorithm to the desired motor first and then build and download the project. All your steps were correct, you only have to switch their orders around. Link to comment Share on other sites More sharing options...
dennisg Posted July 10, 2012 Author Share Posted July 10, 2012 dennisg, You need to assign your user-written servo algorithm to the desired motor first and then build and download the project. All your steps were correct, you only have to switch their orders around. Hi Sina, I'm not sure usercode.c even builds, below is my status window output. Please wait while mapping Power PMAC variables. End of syncing the database. PMAC variables are mapped successfully. Build Process For capp1.out has started. Build Process For capp1.out has ended. Build Succeeded. Please wait while downloading to Power Pmac. Downloading capp1.out to Power Pmac. Downloading global definitions.pmh to Power Pmac. Downloading subprog1.pmc to Power Pmac. Downloading prog1.pmc to Power Pmac. Downloading butterfly.plc to Power Pmac. Downloading encoder_test.plc to Power Pmac. Downloading populate conv table.plc to Power Pmac. Downloading selectable_freqs.plc to Power Pmac. Downloading stepped sine.plc to Power Pmac. Downloading pp_startup.txt to Power Pmac. Downloading pp_disable.txt to Power Pmac. Downloading pp_proj.ini to Power Pmac. uploading pp_error.log file from the Power Pmac. uploading pp_proj.log file from the Power Pmac. uploading pp_error_hist.log file from the Power Pmac. uploading pp_debug.txt file from the Power Pmac. uploading pp_proj.h file from the Power Pmac. Downloading NewAMS2Solution.ppproj to Power Pmac. Uploading and syncing PMAC variables. Download Successful. Link to comment Share on other sites More sharing options...
shansen Posted July 10, 2012 Share Posted July 10, 2012 dennisg: Right click on usrcode.c in the solution explorer tree and select 'Properties'. Verify that the Build Action is set to 'Compile'. Then do another build and download, and verify that your user routine compiles and downloads. Link to comment Share on other sites More sharing options...
dennisg Posted July 10, 2012 Author Share Posted July 10, 2012 dennisg: Right click on usrcode.c in the solution explorer tree and select 'Properties'. Verify that the Build Action is set to 'Compile'. Then do another build and download, and verify that your user routine compiles and downloads. Thanks, that gets it to "compile" now. A whole bunch of errors though. All functions in usercode.c are currently empty so not sure what is causing all these errors. I must not have environment variables set correctly or something. I'm running 1.4.0.62 of the IDE, the PPMAC has the Sept 2011 firmware on it. The error dump is below: ------------------------------------------------------ Please wait while mapping Power PMAC variables. End of syncing the database. PMAC variables are mapped successfully. Build Process For usralgo.ko has ended. Build Process For capp1.out has started. Build Process For usralgo.so has started. C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\/usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/linux/sched.h(16,0): Warning : in file included from /usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/linux/sched.h C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\/usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/linux/module.h(9,0): Warning : in file included from /usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/linux/module.h C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\usrcode.h(1,0): Warning : in file included from usrcode.h C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\usrcode.c(26,0): Warning : in file included from usrcode.c C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\/usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/linux/signal.h(2,0): Warning : #warning "You should include . This time I will do it for you." C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\/usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/linux/sched.h(79,0): Warning : in file included from /usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/linux/sched.h C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\/usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/linux/module.h(9,0): Warning : in file included from /usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/linux/module.h C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\usrcode.h(1,0): Warning : in file included from usrcode.h C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\usrcode.c(26,0): Warning : in file included from usrcode.c C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\/usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/linux/resource.h(2,0): Warning : #warning "You should include . This time I will do it for you." C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\/usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/linux/sched.h(10,0): Warning : in file included from /usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/linux/sched.h C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\/usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/linux/module.h(9,0): Warning : in file included from /usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/linux/module.h C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\usrcode.h(1,0): Warning : in file included from usrcode.h C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\usrcode.c(26,0): Warning : in file included from usrcode.c C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\/usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/linux/rbtree.h(128,0): Error : expected ',' or '...' before 'new' C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\usrcode.h(1,0): Warning : in file included from usrcode.h C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\usrcode.c(26,0): Warning : in file included from usrcode.c C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\/usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/linux/module.h(41,0): Error : field 'attr' has incomplete type C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\/usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/linux/module.h(49,0): Error : field 'kobj' has incomplete type C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\/usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/sched.h(32,0): Warning : in file included from /usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/sched.h C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\/opt/eldk-4.2/debian_rootfs/usr/local/xenomai/include/posix/sched.h(58,0): Warning : in file included from /opt/eldk-4.2/debian_rootfs/usr/local/xenomai/include/posix/sched.h C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\/opt/eldk-4.2/debian_rootfs/usr/local/xenomai/include/posix/pthread.h(147,0): Warning : in file included from /opt/eldk-4.2/debian_rootfs/usr/local/xenomai/include/posix/pthread.h C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\/opt/eldk-4.2/debian_rootfs/opt/ppmac/rtpmac/RtGpShm.h(26,0): Warning : in file included from /opt/eldk-4.2/debian_rootfs/opt/ppmac/rtpmac/RtGpShm.h C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\usrcode.h(2,0): Warning : in file included from usrcode.h C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\usrcode.c(26,0): Warning : in file included from usrcode.c C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\/usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/bits/sched.h(62,0): Error : redefinition of 'struct sched_param' C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\/usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/linux/sched.h(109,0): Error : previous definition of 'struct sched_param' C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\/opt/eldk-4.2/debian_rootfs/opt/ppmac/rtpmac/ecrt.h(96,0): Warning : in file included from /opt/eldk-4.2/debian_rootfs/opt/ppmac/rtpmac/ecrt.h C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\/opt/eldk-4.2/debian_rootfs/opt/ppmac/rtpmac/ethercat.h(2,0): Warning : in file included from /opt/eldk-4.2/debian_rootfs/opt/ppmac/rtpmac/ethercat.h C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\/opt/eldk-4.2/debian_rootfs/opt/ppmac/rtpmac/RtGpShm.h(32,0): Warning : in file included from /opt/eldk-4.2/debian_rootfs/opt/ppmac/rtpmac/RtGpShm.h C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\usrcode.h(2,0): Warning : in file included from usrcode.h C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\usrcode.c(26,0): Warning : in file included from usrcode.c C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\/usr/local/bin/../lib/gcc/powerpc-405-linux-gnu/4.2.2/../../../../powerpc-405-linux-gnu/sys-include/stdlib.h(536,0): Error : declaration does not declare anything C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\usrcode.c(46,0): Error : redefinition of 'double user_pid_ctrl_new(MotorData*)' C:\Users\dennis.gabler\Documents\PowerPmacSuite\NewAMS2Solution\NewAMS2Solution\C Language\Realtime Routines\usrcode.c(36,0): Error : 'double user_pid_ctrl_new(MotorData*)' previously defined here Done building project "NewAMS2Solution.ppproj" -- FAILED. Build FAILED. Build process failed during the Realtime Routines build and download. Link to comment Share on other sites More sharing options...
shansen Posted July 10, 2012 Share Posted July 10, 2012 Could you post your usrcode.c and usrcode.h files? Link to comment Share on other sites More sharing options...
dennisg Posted July 10, 2012 Author Share Posted July 10, 2012 Could you post your usrcode.c and usrcode.h files? I think you are right. I'm running old inherited code that may have never actually compiled. I will start with a fresh solution and go from there. Link to comment Share on other sites More sharing options...
Recommended Posts