6
$\begingroup$

I'm doing a project related to telemetry, and I want to make ArduPilot (programmed with ArduPlane 2.73) send through a serial port the sensors informations such as height, GPS position, etc.. I have tried to use ArduStation, but I could not change its firmware to do what I want.

The idea would be to read the Ardupilot's serial port using an Arduino Uno, and then saving it in a SD card in real-time. So ArduPilot needs to send data without any user input or something like that. I've already tried to manipulate ArduPlane source code to do that, but I couldn't either.

Has someone here did something like that before? I need some advice!

$\endgroup$
3
  • $\begingroup$ I am working on the same thing, I have an APM 2.6 and I want to read via the serial Port the data issued by the sensors! could you help me $\endgroup$
    – user9519
    Commented Apr 16, 2015 at 11:19
  • $\begingroup$ If anyone has figured how to to this, please do post a solution. I am doing a similar project wherein i require the GPS data to be received from an APM 2.6 by an Arduino Mega 2560.Please do advice on how this can be achieved . I am a beginner and mt only coding background is in arduino. $\endgroup$
    – user11677
    Commented Jan 24, 2016 at 6:05
  • $\begingroup$ Hi @Robin_Thomas, welcome to Robotics Stack Exchange. If you have a new question, please start a new thread. Otherwise, "answers" to a question that are not actually answers (like this one) will be deleted. Please check out the help center for how to ask and answer questions. $\endgroup$
    – Ben
    Commented Jan 24, 2016 at 14:32

3 Answers 3

4
$\begingroup$

I understand a new Ardupilot was released recently. I am not familiar with it, so if that's the device you have then this answer may not be helpful. With that said I have done something similar to what you are doing with the Ardupilot Mega. Specifically I wrote a node in ROS to control a quadrotor and read its state. The Ardupilot uses a fairly simple protocol called Mavlink to communicate with other systems. You can get the library from the QGroundControl website linked above. From there you will connect the serial port on your Uno to the Xbee port on the APM. There are two caveats however. First, I don't know whether the Mavlink library will fit on the Uno though I believe it will. Second, it does require that your Uno query the APM by sending requests for data but they are simple enough to construct. The purpose for this is to control the flow of information. If I recall correctly you can instruct the device to repeatedly send the data you are interested in but you will have to review the documentation to confirm as much.

$\endgroup$
2
  • $\begingroup$ So maybe using this library I can make an Arduino send some request to ArduPilot and get as response the data that I want? What have you done exactly? $\endgroup$ Commented Jun 18, 2013 at 22:36
  • $\begingroup$ Yes, that's correct. I use the Ardupilot and ROS to control an autonomous quadrotor in my lab. I have used Mavlink to both send commands to the quadrotor and to query the state and sensor data of the Ardupilot. $\endgroup$ Commented Jun 19, 2013 at 4:08
3
$\begingroup$

To get the sensor data you need:

  • First to write a MAV_DATA_STREAM_EXTRA1 message to the arduCopter. This message tells it to send out the sensor data (and at what rate it should do that). (BTW - this message relates to yaw/pitch/roll data only).
  • Then you read the relevant data message (in this case MAVLINK_MSG_ID_ATTITUDE) and decode the relevant sensor data.
$\endgroup$
0
$\begingroup$

If you just want to write data to the UART, you can use

cliSerial->printf("my output");

cliSerial is an alias for hal.console .

There is a good example here.

UART 2 is unused on the APM so I think you can examine how hal.console is set up and set up your own equivalent that uses UART 2. Looks like you would start with

hal.uartB->begin(115200);

Using the mavlink protocol is also an option but you probably want your own simpler protocol. If you want to use mavlink you can use the gcs_send_text_fmt() function. For example, it is used inside verify_nav_wp() of commands_logic.pde .

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.