title: Changing Mavlink Message Rate ArduPilotMega
body: <p>I am working on a project that uses Mavlink protocol (in c++) to communicate with the ArduPilotMega (2.6).<br>
  I am able to read messages such as <a href="https://pixhawk.ethz.ch/mavlink/#ATTITUDE" rel="nofollow">ATTITUDE</a> for example. The current message rate (for all messages) is 2Hz and I would like to increase this rate.<br>
  I found out that I should probably set <a href="https://pixhawk.ethz.ch/mavlink/#MESSAGE_INTERVAL" rel="nofollow">MESSAGE_INTERVAL</a> using <code>MAV_CMD_SET_MESSAGE_INTERVAL</code> in order to change it.</p>
  
  <p>So my question is:<br>
  How do I send this command message using mavlink in c++?</p>
  
  <p>I tried doing it using the code below but it did not work. I guess I have to use the command I mentioned above, but I don't know how.</p>
  
  <pre><code>mavlink_message_t command;
  mavlink_message_interval_t interval;
  
  interval.interval_us = 100000;
  interval.message_id = 30;
  
  mavlink_msg_message_interval_encode(255, 200, &amp;command, &amp;interval);
  p_sensorsPort-&gt;write_message(command);
  </code></pre>
  
  <p><strong>Update:</strong> I also tried this code below, maybe I am not giving it the right system id or component id.</p>
  
  <pre><code>mavlink_message_t command;
  mavlink_command_long_t interval;
  
  interval.param1 = MAVLINK_MSG_ID_ATTITUDE;
  interval.param2 = 100000;
  interval.command = MAV_CMD_SET_MESSAGE_INTERVAL;
  interval.target_system = 0;
  interval.target_component = 0;
  
  mavlink_msg_command_long_encode(255, 0, &amp;command, &amp;interval);
  p_sensorsPort-&gt;write_message(command);
  </code></pre>
  
  <p>Maybe I am missing something about the difference between <code>target_system</code>, <code>target_component</code> and <code>sysid</code>, <code>compid</code>. I tried few values for each but nothing worked.<br>
  Is there any ACK that will be able to tell me if it even got the command? </p>