Re: Orocos Program

Peter Soetens <[email protected]>
Newsgroups gmane.science.robotics.orocos.user
Organization KU Leuven
Message-ID <[email protected]>
On Monday 17 May 2004 15:27, Andrea Consonni wrote:
> > you want to introduce a constructor like :
> >
> > var Double6D d6 = Double6D(0.,1.,2.,3.,4.,5.)
>
> Exactly!
>
> > you need a 'sixfold' operator ( a function object with 6 parameters )
>
> to do
>
> > the inline construction. The vector constructor uses a TernaryOperator
>
> (See
>
> > Operators.hpp and Operators.cxx). A '[]' operator might be handy too,
>
> bounds
>
> > checking can be done during the program parsing.
>
> For now, we have only interested to define a Double6D variable and pass
> it to
> the Generator MoveTo method.

ok.

> > What do you think ?
>
> We have done some tests using first aproach, but they don't work :-(
> We have added the following instruction:
>
> 1) In "Types.cxx", we have written:
>      data["double6D"] = new TemplateTypeInfo<Double6D>();

this is ok.

>
> 2) In "parser-common.hpp" file, added "double6D" to keywords;

this is optional, but ok.

>
> 3) In "Operators.cxx" we have written the following function (for now we
> only
>    pass a parameter and create a Double6D with the same value for each
>    element):
>
>    Double6D double6Dd( double d )
>    {
>      Double6D d6d;
>      for (int i=0; i<6; i++)
>        d6d[i] = d;
>      return d6d;
>    }

Ok.

>
>    Besides, we have added:
>      add( newUnaryOperator( "double6Dd", std::ptr_fun( &double6Dd ) ) );

ok

>
> 4) In "ExpressionParser.hpp" file we have added "double6Dexp" and
>    "double6Dctor" as attributes;

ok

>
> 5) In "ExpressionParser.cxx" file we have added:
>    - BOOST_SPIRIT_DEBUG_RULE( double6Dexp );
>    - BOOST_SPIRIT_DEBUG_RULE( double6Dctor );
>    - constructorexp =
>         framector
>
>       | vectorctor
>       | double6Dctor
>       | rotationctor;
>
>    - double6Dctor = (
>         str_p( "double6D" )
>
>       >> '('
>       >> expression
>       >> ')' )[ bind( &ExpressionParser::seen_unary, this, "double6Dd" )
>
> ];

ok

>
> We don't have any compile errors, but when we start our program
>
>   program {
>     var double6D Command = double6D(1.0)
>   }
>
> we have the following parser error: "Value "double6D" is not defined..."

Hmm. Could you send me a patch so that i can test it for myself ? This is not 
the kind of error you would expect :-).

>
> What is our problem? Thanks for help.
>
> >> PS: About the release 0.14.2, it's all right :-)
> >
> > Ah finally ! thanks :-)
>
> Sorry, but we think to have found other two problems:
>
> 1) In "HMIConsoleInput.hpp" and "HMIConsoleOutput.hpp" files we think you
> have
>    forgot to write "using namespace ORO_Execution". In your examples you
> don't
>    have any compile errors because you have included
> "CartesianNSComponents.hpp" before those two files. In
> "CartesianNSComponents.hpp" you have written
>
>    "using namespace ORO_Execution" within of "namespace ORO_ControlKernel"
> so
>    all works. If someone (as we) doesn't know this and includes
>    "HMIConsoleInput.hpp" and "HMIConsoleOutput.hpp" before he has included
> some
>    files which contains that instruction, he has very strange compile
> error, much difficult to find.

I'll fix it, sorry for that.

>
> 2) The StartupComponents struct in configuration xml file contains the list
> of
>    components which must be selected when the kernel is started. However,
> we
>    have noted that the componentStartup hook of these components isn't
> executed. Why?

This is strange, this works in the motion_tracking kernel for example. 
Possible mistakes are :
* A spelling error in the xml file (you must specify the unique name given
in the constructor of your component)
* Did you check if the loading of the component returned true ? Did
the start() method return true ?
* Is the function signature correct ? (compile with -Wall)
   virtual bool componentStartup();

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
------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.