I've looked at doing something similar a while back. Seems there are several ways of doing this, but all I've looked at was with Python (which also has a great OpenCV interface, along with the SimpleCV framework.)
What I'm not to sure about it how to connect the raspberry pi to it. There seem to be quite a few topics about connecting a RPi to an APM, however little code following on from that, and none that I have found using TCP/UDP for mavlink (which I know can be done because mavproxy does it!)
Also does anyone know for definte whether SET_ROLL_PITCH_YAW_THRUST ( https://pixhawk.ethz.ch/mavlink/#SET_ROLL_PITCH_YAW_THRUST ) is defiantly implemented in the latest version of ArduPilot? The internet is full of conflicting information, mostly saying it isn't :(
If it isn't what would be the best way to send 'input' to the apm from the RPi, using the RC message seems to be a popular choice, is this wise?
--
You received this message because you are subscribed to the Google Groups "drones-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drones-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
I have also seen that SET_ROLL_PITCH_YAW_THRUST message and it does look like a good one to add support for. In copter I suspect we’d make the get-pilot-desired-climb-rate and get-pilot-desired-lean-angles make the decision about whether to read in from the latest SET_ROLL_PITCH_YAW_THRUST value or the RC.
We’d need to think it through so I’d like to discuss it with Kevin and Tridge on a future dev call. I’m also quite consumed at the moment preparing for AC3.2-rc1.
-Randy
Chris,
Also what you’re doing sounds very similar to what a number of us on the dev team need to do for the Sparkfun AVC which involves finding and popping 1m red balloons.
A few of us will be using a slightly different set-up from what you’re using. We will use:
1. Odroid U3. http://dev.ardupilot.com/wiki/odroid-via-mavlink/
2. Drone-api (as mentioned by Kevin below)
3. Coding in python and its embryonic form is here: https://github.com/rmackay9/ardupilot-balloon-finder/tree/master/scripts
-Randy
Hello again
So I've managed to bodge together some code from the example C code in mavlink (https://github.com/mavlink/c_uart_interface_example/blob/master/mavlink_serial.cpp) to use a socket instead, and I can get heartbeat messages (but not much else) (I assume from the simulator) over the network;
Received serial data: fe 09 fd 01 01 00 02 00 00 00 02 03 d1 04 03 b4 7c
Received message from serial with ID #0 (sys:1|comp:1):
Got heartbeat message
type: 2
autopilot: 3
base_mode: 209
system_status: 4
mavlink_version: 3
So the next step is to try and send a message :)
I'm trying the mavlink_rc_channels_override message, but not having much luck. I think it might be to do with my target system and component ids?
This is the message code I have at the moment
mavlink_message_t message;
mavlink_rc_channels_override_t rccontrol;
rccontrol.chan1_raw = 1500; //roll
rccontrol.chan2_raw = 1900; //pitch
rccontrol.chan3_raw = 1500; //throttle
rccontrol.chan4_raw = 1500; //yaw
rccontrol.target_system = 1;
rccontrol.target_component = 1;
mavlink_msg_rc_channels_override_encode(1, 1, &message, &rccontrol);
I see a "New connection on serial port x" on the simulator, however the message doesn't seem to get though to the correct thing. Reading up it might because the target system and component are wrong? That or the local system_id and compent_id (although I thought I could just make these up?)
Do I need to send a regular heatbeat as well, as some places suggest? if so do these need to be regular, or can I just send 1 at the start?
I've manually armed the simulator using MavProxy at the moment, and using the rc channel pwn command (eg rc 1 1900) works and the copter flies around the map :)
I'd be grateful for any assistance
Cheers
Chris
On Thursday, 24 April 2014 17:05:00 UTC+1, Christopher Cosmo Rogers wrote:Hi
So I have a project using a raspberry pi tracking a target with it's camera, and outputting roll, pitch and yaw.
My next step is to connect it to a APM2.5, however rather than crashing an actual craft, I want to demo it using the SITL simulator.
I've got that running fine, can connect flightgear, mavproxy, etc.
What I'm not to sure about it how to connect the raspberry pi to it. There seem to be quite a few topics about connecting a RPi to an APM, however little code following on from that, and none that I have found using TCP/UDP for mavlink (which I know can be done because mavproxy does it!)
The most useful example code I have found so far is
https://github.com/mavlink/c_uart_interface_example/blob/master/send_quad_commands.cpp
But that is connecting over serial, fine if I was using an actual APM, but I want to connect over TCP/UDP.
This
https://github.com/mavlink/mavlink/blob/master/examples/linux/mavlink_udp.c
uses UDP, but is the 'wrong' way around, it's connecting to QGroundControl. I want the opposite (so in effect the RPi becomes a ground control station sending the craft commands)
Also does anyone know for definte whether SET_ROLL_PITCH_YAW_THRUST ( https://pixhawk.ethz.ch/mavlink/#SET_ROLL_PITCH_YAW_THRUST ) is defiantly implemented in the latest version of ArduPilot? The internet is full of conflicting information, mostly saying it isn't :(
If it isn't what would be the best way to send 'input' to the apm from the RPi, using the RC message seems to be a popular choice, is this wise?
I'm writing this all in C/C++, which I am not an expert in by any measure. I have gone though the opencv demos, tutorials and examples to piece together the vision part, which seems to be working quite well now, but Mavlink doesn't seem to have the same level of demos and tutorials. Most of the examples that do exist (eg on the mavlink website) seem to be about using mavlink on your robot and then using an existing ground station, rather than making a realllllly simple ground station. If I have missed some them please point them out!
Thanks a bunch
Chris
--
--
You received this message because you are subscribed to a topic in the Google Groups "drones-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/drones-discuss/04n0dvZW3CM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to drones-discus...@googlegroups.com.