public MAVLinkMessage(MAVLinkSchema schema,String msgName,int systemID,int componentID){
  this.schema=schema;
  this.definition=schema.getMessageDefinition(msgName);
  if (definition == null) {
    throw new RuntimeException("Unknown mavlink message name: " + msgName);
  }
  this.payload=new byte[definition.payloadLength];
  this.payloadBB=ByteBuffer.wrap(payload);
  payloadBB.order(schema.getByteOrder());
  this.systemID=systemID;
  this.componentID=componentID;
  this.msgID=definition.id;
}

public MAVLinkMessage ( MAVLinkSchema schema , String msgName , int systemID , int componentID ) { this . schema = schema ; this . definition = schema . getMessageDefinition ( msgName ) ; if ( definition == null ) { throw new RuntimeException ( "Unknown mavlink message name: " + msgName ) ; } this . payload = new byte [ definition . payloadLength ] ; this . payloadBB = ByteBuffer . wrap ( payload ) ; payloadBB . order ( schema . getByteOrder ( ) ) ; this . systemID = systemID ; this . componentID = componentID ; this . msgID = definition . id ; }
create empty message by message name ( for filling and sending )
