Re: Problem when calling commands from within a TaskContext

Ruben Smits <[email protected]> Thu, 24 May 2007 11:48:25 +0200
Newsgroups gmane.science.robotics.orocos.user
Message-ID <[email protected]>
On Thursday May 24 2007 11:33:18 Lars-Peter Ellekilde wrote:
[..]

I don't know if this would fix your problem but i would change the code into
>
>
> class Task2: public RTT::TaskContext {
> public:
>     Task2(std::string name): TaskContext(name) {}
>	
>     ~Task2() {}
>
> private:

	RTT::Command<bool(void)> commandfromT1;

>     bool startup() { 
	       
commandfromT1=getPeer("Task1")->commands()->getCommand<bool(void)>("mycmd");
return commandfromT1.ready();
> } 

       

>     void update() {
        bool b = cmd();
>     }
>
>     void shutdown() {}
>
> };
> **
>  * main() function
>  */
> int ORO_main(int arc, char* argv[])
> {
>
>     Task1 task1("Task1");
>     Task2 task2("Task2");
>
>     connectPeers(&task1, &task2);
>
>     PeriodicActivity activity1(OS::HighestPriority, 0.01, task1.engine() );
>     activity1.start();
>
>     PeriodicActivity activity2(OS::LowestPriority, 1, task2.engine() );
>     activity2.start();
>
>     while (true) sleep(10);
>
>     return 0;
> }



-- 
Ir. Ruben Smits
Robotics Group, Mechanical Engineering,
KULeuven
-- 
Orocos mailing list
[email protected]
http://lists.mech.kuleuven.be/mailman/listinfo/orocos

Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm