(sorry, I send this mail incomplete before)

Hi all,
I am doing a custom plugin driver for our robot (romaa). The robot have the posibility to send speed command in linear and angular speed mode, and in wheel speed mode to control each wheel independently. So, I would like to do a driver for both modes.

First I did a driver with the position2d interface to command the robot with linear and angular speed, and it work well.  The interface is obtained from the .cfg file as follow

if ( cf->ReadDeviceAddr( &position2d_addr, section, "provides",
            PLAYER_POSITION2D_CODE, -1, NULL) == 0 )
{
    if ( this->AddInterface( position2d_addr ) != 0 )
    {
        PLAYER_ERROR( "Error adding position2d interface" );
        this->SetError(-1);
        return;
    }
}
with the index=-1 so it look for any index.

Next, I did a driver to send wheel speed command using two position1d interfaces. In the class constructor the two position1d interface are obtained from the .cfg file, as follow

  if ( cf->ReadDeviceAddr( &position1d_addr1, section, "provides",
        PLAYER_POSITION1D_CODE, 0, NULL) == 0 )
  {
    if ( this->AddInterface( position1d_addr1 ) != 0 )
    {  
      PLAYER_ERROR( "Error adding position1d interface" );
      this->SetError(-1);
      return;
    }  
  }
  if ( cf->ReadDeviceAddr( &position1d_addr2, section, "provides",
        PLAYER_POSITION1D_CODE, 1, NULL) == 0 )
  {
    if ( this->AddInterface( position1d_addr2 ) != 0 )
    {  
      PLAYER_ERROR( "Error adding position1d interface" );
      this->SetError(-1);
      return;
    }  
  }
one with an index=0 and the other with index=1.

And last, I did another driver trying to mix this both. Using one position2d interface and two position1d interfaces. But it did not work.
It only work if I change the indexes of the two position1d interfaces to 1 and 2 (in the above code section), and in .cfg file, so the provided parameter is

provides [ "position2d:0"
                  "position1d:1"
                  "position1d:2" ]

How would be the right way to get working these tree interfaces (one position2d and two position1d) in the same driver?? I do not know how to use the "key" field of the devide address. What is the better way to do this? Any help would be appreciate

And, another quiestion is related to the way the position1d data are publishes in the Main method, I use the following

  PLAYER_MSG0( 3, "read wheel speed..." );
  if( romaa_comms->get_wheel_linear_speed( v1, v2 ) == -1 )
  {  
    PLAYER_ERROR( "read odometry" );
  }  
  else
  {  
    position1d_data1.vel = v1;
    position1d_data2.vel = v2;
  }  
  Publish( position1d_addr1,
      PLAYER_MSGTYPE_DATA, PLAYER_POSITION1D_DATA_STATE,
      (void*)&position1d_data1, sizeof( player_position1d_data_t ), NULL );

  Publish( position1d_addr2,
      PLAYER_MSGTYPE_DATA, PLAYER_POSITION1D_DATA_STATE,
      (void*)&position1d_data2, sizeof( player_position1d_data_t ), NULL );

is this ok??

If with these section code is unclear, I can send the source files.

Thanks in advance

--
Gonzalo F. Perez Paina
Centro de Investigación en Informática para la Ingeniería, CIII.
Universidad Tecnológica Nacional. Facultad Regional Córdoba.
Maestro M. López esq. Cruz Roja Argentina. CP X5016ZAA
gperez@scdt.frc.utn.edu.ar