/**
   * Generates the payload for a mavlink message for a message of this type
   *
   * @return
   */
  public MAVLinkPacket pack() {
    MAVLinkPacket packet = new MAVLinkPacket();
    packet.len = MAVLINK_MSG_LENGTH;
    packet.sysid = 255;
    packet.compid = 190;
    packet.msgid = MAVLINK_MSG_ID_LANDING_TARGET;

    packet.payload.putUnsignedLong(time_usec);

    packet.payload.putFloat(angle_x);

    packet.payload.putFloat(angle_y);

    packet.payload.putFloat(distance);

    packet.payload.putFloat(size_x);

    packet.payload.putFloat(size_y);

    packet.payload.putUnsignedByte(target_num);

    packet.payload.putUnsignedByte(frame);

    return packet;
  }
 /**
 * Generates the payload for a mavlink message for a message of this type
 * @return
 */
 public MAVLinkPacket pack(){
     MAVLinkPacket packet = new MAVLinkPacket();
     packet.len = MAVLINK_MSG_LENGTH;
     packet.sysid = 255;
     packet.compid = 190;
     packet.msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT;
           
     packet.payload.putUnsignedInt(time_boot_ms);
           
     packet.payload.putInt(lat);
           
     packet.payload.putInt(lon);
           
     packet.payload.putInt(alt);
           
     packet.payload.putInt(relative_alt);
           
     packet.payload.putShort(vx);
           
     packet.payload.putShort(vy);
           
     packet.payload.putShort(vz);
           
     packet.payload.putUnsignedShort(hdg);
     
     return packet;
 }
 /**
 * Generates the payload for a mavlink message for a message of this type
 * @return
 */
 public MAVLinkPacket pack(){
     MAVLinkPacket packet = new MAVLinkPacket();
     packet.len = MAVLINK_MSG_LENGTH;
     packet.sysid = 255;
     packet.compid = 190;
     packet.msgid = MAVLINK_MSG_ID_HOME_POSITION;
           
     packet.payload.putInt(latitude);
           
     packet.payload.putInt(longitude);
           
     packet.payload.putInt(altitude);
           
     packet.payload.putFloat(x);
           
     packet.payload.putFloat(y);
           
     packet.payload.putFloat(z);
           
     
     for (int i = 0; i < q.length; i++) {
         packet.payload.putFloat(q[i]);
     }
                 
           
     packet.payload.putFloat(approach_x);
           
     packet.payload.putFloat(approach_y);
           
     packet.payload.putFloat(approach_z);
     
     return packet;
 }
 /**
 * Generates the payload for a mavlink message for a message of this type
 * @return
 */
 public MAVLinkPacket pack(){
     MAVLinkPacket packet = new MAVLinkPacket();
     packet.len = MAVLINK_MSG_LENGTH;
     packet.sysid = 255;
     packet.compid = 190;
     packet.msgid = MAVLINK_MSG_ID_SERIAL_CONTROL;
           
     packet.payload.putUnsignedInt(baudrate);
           
     packet.payload.putUnsignedShort(timeout);
           
     packet.payload.putUnsignedByte(device);
           
     packet.payload.putUnsignedByte(flags);
           
     packet.payload.putUnsignedByte(count);
           
     
     for (int i = 0; i < data.length; i++) {
         packet.payload.putUnsignedByte(data[i]);
     }
                 
     
     return packet;
 }
 @Test
 public void test() {
   byte[] packet = generateTestPacket();
   for (int i = 0; i < packet.length - 1; i++) {
     parser.mavlink_parse_char(packet[i] & 0xFF);
   }
   MAVLinkPacket m = parser.mavlink_parse_char(packet[packet.length - 1] & 0xFF);
   byte[] processedPacket = m.encodePacket();
   assertArrayEquals("msg_servo_output_raw", processedPacket, packet);
 }
 /**
 * Generates the payload for a mavlink message for a message of this type
 * @return
 */
 public MAVLinkPacket pack(){
     MAVLinkPacket packet = new MAVLinkPacket();
     packet.len = MAVLINK_MSG_LENGTH;
     packet.sysid = 255;
     packet.compid = 190;
     packet.msgid = MAVLINK_MSG_ID_MISSION_ITEM_REACHED;
           
     packet.payload.putUnsignedShort(seq);
     
     return packet;
 }
  /**
   * Generates the payload for a mavlink message for a message of this type
   *
   * @return
   */
  public MAVLinkPacket pack() {
    MAVLinkPacket packet = new MAVLinkPacket();
    packet.len = MAVLINK_MSG_LENGTH;
    packet.sysid = 255;
    packet.compid = 190;
    packet.msgid = MAVLINK_MSG_ID_AUTH_KEY;
    for (int i = 0; i < key.length; i++) {
      packet.payload.putByte(key[i]);
    }

    return packet;
  }
Exemplo n.º 8
0
  /**
   * Generates the payload for a mavlink message for a message of this type
   *
   * @return
   */
  public MAVLinkPacket pack() {
    MAVLinkPacket packet = new MAVLinkPacket();
    packet.len = MAVLINK_MSG_LENGTH;
    packet.sysid = 255;
    packet.compid = 190;
    packet.msgid = MAVLINK_MSG_ID_WIND;
    packet.payload.putFloat(direction);
    packet.payload.putFloat(speed);
    packet.payload.putFloat(speed_z);

    return packet;
  }
Exemplo n.º 9
0
  /**
   * Generates the payload for a mavlink message for a message of this type
   *
   * @return
   */
  public MAVLinkPacket pack() {
    MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH);
    packet.sysid = 255;
    packet.compid = 190;
    packet.msgid = MAVLINK_MSG_ID_MEMINFO;

    packet.payload.putUnsignedShort(brkval);

    packet.payload.putUnsignedShort(freemem);

    return packet;
  }
Exemplo n.º 10
0
  /**
   * Generates the payload for a mavlink message for a message of this type
   *
   * @return
   */
  public MAVLinkPacket pack() {
    MAVLinkPacket packet = new MAVLinkPacket();
    packet.len = MAVLINK_MSG_LENGTH;
    packet.sysid = 255;
    packet.compid = 190;
    packet.msgid = MAVLINK_MSG_ID_HWSTATUS;

    packet.payload.putUnsignedShort(Vcc);

    packet.payload.putUnsignedByte(I2Cerr);

    return packet;
  }
Exemplo n.º 11
0
  /**
   * Generates the payload for a mavlink message for a message of this type
   *
   * @return
   */
  public MAVLinkPacket pack() {
    MAVLinkPacket packet = new MAVLinkPacket();
    packet.len = MAVLINK_MSG_LENGTH;
    packet.sysid = 255;
    packet.compid = 190;
    packet.msgid = MAVLINK_MSG_ID_RANGEFINDER;

    packet.payload.putFloat(distance);

    packet.payload.putFloat(voltage);

    return packet;
  }
  /**
   * Generates the payload for a mavlink message for a message of this type
   *
   * @return
   */
  public MAVLinkPacket pack() {
    MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH);
    packet.sysid = 255;
    packet.compid = 190;
    packet.msgid = MAVLINK_MSG_ID_GIMBAL_AXIS_CALIBRATION_PROGRESS;

    packet.payload.putUnsignedByte(calibration_axis);

    packet.payload.putUnsignedByte(calibration_progress);

    packet.payload.putUnsignedByte(calibration_status);

    return packet;
  }
  /**
   * Generates the payload for a mavlink message for a message of this type
   *
   * @return
   */
  public MAVLinkPacket pack() {
    MAVLinkPacket packet = new MAVLinkPacket();
    packet.len = MAVLINK_MSG_LENGTH;
    packet.sysid = 255;
    packet.compid = 190;
    packet.msgid = MAVLINK_MSG_ID_GPS_INJECT_DATA;
    packet.payload.putByte(target_system);
    packet.payload.putByte(target_component);
    packet.payload.putByte(len);
    for (int i = 0; i < data.length; i++) {
      packet.payload.putByte(data[i]);
    }

    return packet;
  }
Exemplo n.º 14
0
  /**
   * Generates the payload for a mavlink message for a message of this type
   *
   * @return
   */
  public MAVLinkPacket pack() {
    MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH);
    packet.sysid = 255;
    packet.compid = 190;
    packet.msgid = MAVLINK_MSG_ID_SET_MAG_OFFSETS;

    packet.payload.putShort(mag_ofs_x);

    packet.payload.putShort(mag_ofs_y);

    packet.payload.putShort(mag_ofs_z);

    packet.payload.putUnsignedByte(target_system);

    packet.payload.putUnsignedByte(target_component);

    return packet;
  }
  /**
   * Generates the payload for a mavlink message for a message of this type
   *
   * @return
   */
  public MAVLinkPacket pack() {
    MAVLinkPacket packet = new MAVLinkPacket();
    packet.len = MAVLINK_MSG_LENGTH;
    packet.sysid = 255;
    packet.compid = 190;
    packet.msgid = MAVLINK_MSG_ID_VISION_POSITION_ESTIMATE;

    packet.payload.putUnsignedLong(usec);

    packet.payload.putFloat(x);

    packet.payload.putFloat(y);

    packet.payload.putFloat(z);

    packet.payload.putFloat(roll);

    packet.payload.putFloat(pitch);

    packet.payload.putFloat(yaw);

    return packet;
  }
Exemplo n.º 16
0
  /**
   * Generates the payload for a mavlink message for a message of this type
   *
   * @return
   */
  public MAVLinkPacket pack() {
    MAVLinkPacket packet = new MAVLinkPacket();
    packet.len = MAVLINK_MSG_LENGTH;
    packet.sysid = 255;
    packet.compid = 190;
    packet.msgid = MAVLINK_MSG_ID_LED_CONTROL;

    packet.payload.putUnsignedByte(target_system);

    packet.payload.putUnsignedByte(target_component);

    packet.payload.putUnsignedByte(instance);

    packet.payload.putUnsignedByte(pattern);

    packet.payload.putUnsignedByte(custom_len);

    for (int i = 0; i < custom_bytes.length; i++) {
      packet.payload.putUnsignedByte(custom_bytes[i]);
    }

    return packet;
  }
 /**
 * Generates the payload for a mavlink message for a message of this type
 * @return
 */
 public MAVLinkPacket pack(){
     MAVLinkPacket packet = new MAVLinkPacket();
     packet.len = MAVLINK_MSG_LENGTH;
     packet.sysid = 255;
     packet.compid = 190;
     packet.msgid = MAVLINK_MSG_ID_MISSION_ITEM;
           
     packet.payload.putFloat(param1);
           
     packet.payload.putFloat(param2);
           
     packet.payload.putFloat(param3);
           
     packet.payload.putFloat(param4);
           
     packet.payload.putFloat(x);
           
     packet.payload.putFloat(y);
           
     packet.payload.putFloat(z);
           
     packet.payload.putUnsignedShort(seq);
           
     packet.payload.putUnsignedShort(command);
           
     packet.payload.putUnsignedByte(target_system);
           
     packet.payload.putUnsignedByte(target_component);
           
     packet.payload.putUnsignedByte(frame);
           
     packet.payload.putUnsignedByte(current);
           
     packet.payload.putUnsignedByte(autocontinue);
     
     return packet;
 }
Exemplo n.º 18
0
  /**
   * Generates the payload for a mavlink message for a message of this type
   *
   * @return
   */
  public MAVLinkPacket pack() {
    MAVLinkPacket packet = new MAVLinkPacket(MAVLINK_MSG_LENGTH);
    packet.sysid = 255;
    packet.compid = 190;
    packet.msgid = MAVLINK_MSG_ID_DISTANCE_SENSOR;

    packet.payload.putUnsignedInt(time_boot_ms);

    packet.payload.putUnsignedShort(min_distance);

    packet.payload.putUnsignedShort(max_distance);

    packet.payload.putUnsignedShort(current_distance);

    packet.payload.putUnsignedByte(type);

    packet.payload.putUnsignedByte(id);

    packet.payload.putUnsignedByte(orientation);

    packet.payload.putUnsignedByte(covariance);

    return packet;
  }
Exemplo n.º 19
0
 private void queueToLog(MAVLinkPacket packet) {
   if (packet != null) queueToLog(packet.encodePacket());
 }
Exemplo n.º 20
0
 public void sendMavPacket(MAVLinkPacket packet) {
   final byte[] packetData = packet.encodePacket();
   if (!mPacketsToSend.offer(packetData)) {
     mLogger.logErr(TAG, "Unable to send mavlink packet. Packet queue is full!");
   }
 }