Re: Controller Component and sample freq
Peter Soetens <[email protected]>
| Newsgroups | gmane.science.robotics.orocos.user |
|---|---|
| Organization | KU Leuven |
| Message-ID | <[email protected]> |
On Thursday 01 April 2004 15:33, [email protected] wrote: > Hi, > > we are two students of the Politecnico di Milano and we are working on a > thesis about robotics with professor G. Magnani. We have downloaded and > installed Orocos 0.12.0 on PC with linux kernel 2.4.22, Adeos and RTAI > 24.1.12. > > We are implementing some components for controlling a 6DOF robot. > > While implementing our specific OROCOS Controller component we faced the > problem of relating the control system parameters with the the sample > frequency of the OROCOS Kernel. Actually, we think that any controller > component needs to know the sample frequency of the kernel which uses it > because, in our opinion, the parameters of every discrete control alghoritm > depend on that frequency. I agree fully. To know the period of the kernel, you can do the following in any component : if ( this->inKernel() && this->kernel()->getTask() ) T_seconds = this->kernel()->getTask()->periodGet(); else // component not loaded or no task assigned to kernel kernel() returns a KernelBaseFunction* getTask() returns a TaskInterface* There is also a this->kernel()->getPeriod(), which returns the frequency in the kernel_config.xml file. In the ideal world, this is also the frequency of your kernel-task _if_ you did the following : MyKernel kernel; // Get Frequency from xml file and configure KernelConfig kconf(mykernel, "kernel_config.xml"); kconf.configure(); // Create a task, but ask the kernel the frequency TaskNonPreemptible ktask( mykernel.getPeriod(), &mykernel ); Then you can also write : if ( this->inKernel() ) T_seconds = this->kernel()->getPeriod(); I am planning to extend KernelConfig such that KernelConfig creates the Task (according to the XML file) and makes sure that the frequency is correctly set. Then the second approach will always be valid. Peter -- ------------------------------------------------------------------------ Peter Soetens, Research Assistent http://www.orocos.org Katholieke Universiteit Leuven Division Production Engineering, tel. +32 16 322773 Machine Design and Automation fax. +32 16 322987 Celestijnenlaan 300B [email protected] B-3001 Leuven Belgium http://www.mech.kuleuven.ac.be/pma ------------------------------------------------------------------------