logo
Published on The Orocos Project (http://www.orocos.org)

[Bug 488] New: AnalogIn/OutInterface is an atrocity.

By sspr
Created 2008-01-15 14:45

For more infomation about this bug, visit <https://www.fmtc.be/bugzilla/orocos/show_bug.cgi?id=488>

           Summary: AnalogIn/OutInterface is an atrocity.
           Product: RTT
           Version: 1.4.0
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Operating System Abstraction - Portability
        AssignedTo: orocos-dev at lists [dot] mech [dot] kuleuven [dot] be
        ReportedBy: peter.soetens at fmtc [dot] be
                CC: orocos-dev at lists [dot] mech [dot] kuleuven [dot] be
   Estimated Hours: 0.0

In contrast to the DigitalIn/OutInterface classes, the AnalogIn/OutInterface
takes a template parameter. Furthermore, the AnalogOutput helper class takes
the same parameter. It was meant to allow the choice between unsigned/signed
int or even float or double as the interface to an IO card with analog in or
out channels.

In reality the drivers return an int, or an unsigned int and uses max 16 bits,
but 12 bits ADC/DAC are more common. The AnalogOutput object allows conversion
between doubles and this integer value. I believe RTT 1.0 should have used
'int' as the data type for communicating with the analog interfaces. This would
have allowed devices with 31 bit unsigned int ADC/DAC and 32bit signed ADC/DAC,
far more than necessary.

Usercode would have changed from:

 AnalogOutInterface<unsigned int>* maout = AnalogOutInterface<unsigned

int>::nameserver.getObject("Ana_Out");

 AnalogOutput<unsigned int> output(maout, ANA_CHANNEL);
 output.value( v ); // in volts.

to:

 AnalogOutInterface* maout =

AnalogOutInterface::nameserver.getObject("Ana_Out");

 AnalogOutput output(maout, ANA_CHANNEL);
 output.value( v ); // in volts.

Which is consistent with the DigitalIn/OutInterface.

I don't have any idea how to solve this with respect to backwards
compatibility, since these classes also appear in user code.


‹ RTT::Logger patch allowing creation with automatic attachment to ostream [Bug 537] New: OCL:: CartesianGeneratorPos is hardcode to 6DOF - unable use with redundant robots ›

Source URL:
http://www.orocos.org/node/533