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$
  • $\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 Apr 16 '15 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 Jan 24 '16 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 Jan 24 '16 at 14:32
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$
  • $\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$ – Alessandro Soares Jun 18 '13 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$ – DaemonMaker Jun 19 '13 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, privacy policy and cookie policy

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