Re: Re: Orocos Program
"Andrea Consonni" <[email protected]>
| Newsgroups | gmane.science.robotics.orocos.user |
|---|---|
| Message-ID | <[email protected]> |
>>> BTW you probably want to specify 7 parameters to add a time or velocity
>>> argument. If you could provide more details about what your program
>>> script should do, I'll be happy to see how it fits in Orocos.
>>
>> We would want to specify 6 joint positions and 6 velocity or time
>> arguments. We have tried to extending the Orocos parser to support
>> Double6D type, but we have compile errors.
>> How could we do this?
> It's not easy if you're not familiar with the template technique... :-]
> It is very shortly introduced in the program parser manual how you have
to
> add a custom type (like vector,frame) in the parser. Once the type is
known,
> you can do any operation (like +,*,..) which is defined in the added type.
> I agree that for a first tryout, two Double6Ds could be used. However,
if
> 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.
> Once these are in place, the Operators.cxx file must be adapted to contain
> all Double6D operations. When the ExpressionParser is extended with this
> type, it can be used by the whole parser.
> This aproach only scales limited. For each Double'N'D, we need to start
all
> over again (there are 6[+/-] axis machines). The parser was not meant
to
> tackle a wide range of function parameters. Of course, an alternative
(which
> scales better) must be provided if we reach the limits of the parser.
> Specifying a 3D Trajectory* to the generator is also impossible using
the
> parser, but instructing the generator to loadFile("trajectory.trj"), is
much
> more suited.
> Another option is introducing an 'array' type which maps to a vector<double>
> in the implementation. We would still need the [] operator though.
> 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>();
2) In "parser-common.hpp" file, added "double6D" to keywords;
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;
}
Besides, we have added:
add( newUnaryOperator( "double6Dd", std::ptr_fun( &double6Dd ) ) );
4) In "ExpressionParser.hpp" file we have added "double6Dexp" and
"double6Dctor" as attributes;
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" )
];
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..."
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.
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?
Regard
Andrea & Stefano