aboutsummaryrefslogtreecommitdiff
path: root/src/modules/mavlink/mavlink_main.cpp
diff options
context:
space:
mode:
authorTrent Lukaczyk <aerialhedgehog@gmail.com>2015-01-31 15:00:16 -0800
committerTrent Lukaczyk <aerialhedgehog@gmail.com>2015-01-31 15:00:16 -0800
commitd036fa10c1f26576bac27c130843fac45098b736 (patch)
tree2613b11c0e0244576aa024e913f42f5a42767b33 /src/modules/mavlink/mavlink_main.cpp
parent48669846724f6afcf00620a197a26d00107c1076 (diff)
parenta2a244584e36a0e9ffdb93a0dda8473baf8344d3 (diff)
downloadpx4-firmware-d036fa10c1f26576bac27c130843fac45098b736.tar.gz
px4-firmware-d036fa10c1f26576bac27c130843fac45098b736.tar.bz2
px4-firmware-d036fa10c1f26576bac27c130843fac45098b736.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/modules/mavlink/mavlink_main.cpp')
-rw-r--r--src/modules/mavlink/mavlink_main.cpp44
1 files changed, 14 insertions, 30 deletions
diff --git a/src/modules/mavlink/mavlink_main.cpp b/src/modules/mavlink/mavlink_main.cpp
index b99719821..8eeeb5bd7 100644
--- a/src/modules/mavlink/mavlink_main.cpp
+++ b/src/modules/mavlink/mavlink_main.cpp
@@ -904,20 +904,20 @@ Mavlink::send_statustext(unsigned char severity, const char *string)
mavlink_logbuffer_write(&_logbuffer, &logmsg);
}
-MavlinkOrbSubscription *Mavlink::add_orb_subscription(const orb_id_t topic)
+MavlinkOrbSubscription *Mavlink::add_orb_subscription(const orb_id_t topic, int instance)
{
/* check if already subscribed to this topic */
MavlinkOrbSubscription *sub;
LL_FOREACH(_subscriptions, sub) {
- if (sub->get_topic() == topic) {
+ if (sub->get_topic() == topic && sub->get_instance() == instance) {
/* already subscribed */
return sub;
}
}
/* add new subscription */
- MavlinkOrbSubscription *sub_new = new MavlinkOrbSubscription(topic);
+ MavlinkOrbSubscription *sub_new = new MavlinkOrbSubscription(topic, instance);
LL_APPEND(_subscriptions, sub_new);
@@ -948,7 +948,6 @@ Mavlink::configure_stream(const char *stream_name, const float rate)
/* delete stream */
LL_DELETE(_streams, stream);
delete stream;
- warnx("deleted stream %s", stream->get_name());
}
return OK;
@@ -1287,30 +1286,11 @@ Mavlink::task_main(int argc, char *argv[])
}
if (Mavlink::instance_exists(_device_name, this)) {
- warnx("mavlink instance for %s already running", _device_name);
+ warnx("%s already running", _device_name);
return ERROR;
}
- /* inform about mode */
- switch (_mode) {
- case MAVLINK_MODE_NORMAL:
- warnx("mode: NORMAL");
- break;
-
- case MAVLINK_MODE_CUSTOM:
- warnx("mode: CUSTOM");
- break;
-
- case MAVLINK_MODE_ONBOARD:
- warnx("mode: ONBOARD");
- break;
-
- default:
- warnx("ERROR: Unknown mode");
- break;
- }
-
- warnx("data rate: %d Bytes/s, port: %s, baud: %d", _datarate, _device_name, _baudrate);
+ warnx("mode: %u, data rate: %d B/s on %s @ %dB", _mode, _datarate, _device_name, _baudrate);
/* flush stdout in case MAVLink is about to take it over */
fflush(stdout);
@@ -1338,7 +1318,7 @@ Mavlink::task_main(int argc, char *argv[])
* marker ring buffer approach.
*/
if (OK != message_buffer_init(2 * sizeof(mavlink_message_t) + 1)) {
- errx(1, "can't allocate message buffer, exiting");
+ errx(1, "msg buf:");
}
/* initialize message buffer mutex */
@@ -1405,17 +1385,23 @@ Mavlink::task_main(int argc, char *argv[])
configure_stream("POSITION_TARGET_GLOBAL_INT", 3.0f);
configure_stream("ATTITUDE_TARGET", 3.0f);
configure_stream("DISTANCE_SENSOR", 0.5f);
- configure_stream("OPTICAL_FLOW", 5.0f);
+ configure_stream("OPTICAL_FLOW_RAD", 5.0f);
break;
case MAVLINK_MODE_ONBOARD:
configure_stream("SYS_STATUS", 1.0f);
configure_stream("ATTITUDE", 50.0f);
configure_stream("GLOBAL_POSITION_INT", 50.0f);
+ configure_stream("LOCAL_POSITION_NED", 30.0f);
configure_stream("CAMERA_CAPTURE", 2.0f);
configure_stream("ATTITUDE_TARGET", 10.0f);
configure_stream("POSITION_TARGET_GLOBAL_INT", 10.0f);
+ configure_stream("POSITION_TARGET_LOCAL_NED", 10.0f);
+ configure_stream("DISTANCE_SENSOR", 10.0f);
+ configure_stream("OPTICAL_FLOW_RAD", 10.0f);
configure_stream("VFR_HUD", 10.0f);
+ configure_stream("SYSTEM_TIME", 1.0f);
+ configure_stream("TIMESYNC", 10.0f);
break;
default:
@@ -1566,8 +1552,6 @@ Mavlink::task_main(int argc, char *argv[])
_subscriptions = nullptr;
- warnx("waiting for UART receive thread");
-
/* wait for threads to complete */
pthread_join(_receive_thread, NULL);
@@ -1638,7 +1622,7 @@ Mavlink::start(int argc, char *argv[])
SCHED_PRIORITY_DEFAULT,
2800,
(main_t)&Mavlink::start_helper,
- (const char **)argv);
+ (char * const *)argv);
// Ensure that this shell command
// does not return before the instance