18 Commits

Author SHA1 Message Date
Mark Charlebois
d66b6ea701 POSIX: px4_getpid() fix
Since the PX4 code uses both px4_task and pthread APIs,
px4_getpid() must be save to call from either context.

On posix, this means we have to always return the pthread ID.

Reverted simulator change of pthread to px4_task

There may have been side effects if this was build for a target that
has process/task scoped file descriptors. It is now safe to call
px4_getpid() from this pthread context with this change for the
posix build for px4_getpid().

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-06-15 08:25:57 -07:00
Mark Charlebois
7e7513bc15 POSIX: change pthreads to px4_tasks in simulator
The simulator was using pthread APIs directly so calls to px4_getpid()
would fail since the task ID was not known. Changed simulator to use
px4_task_spawn_cmd.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-06-13 16:44:29 -07:00
tumbili
a5c214a7bb use orb_advertise_multi:
- subscribe to actuator controls after topic has been advertised
2015-06-08 22:21:59 -07:00
tumbili
065ec5b2dc no need to send non-controls mavlink messages to jMAVSim because we can use mavlink app with udp 2015-06-08 22:21:59 -07:00
tumbili
8eee7ba321 compute atmospheric pressure from altitude 2015-06-08 22:21:59 -07:00
Mark Charlebois
fd1effa4fe Simulator: UART changes
Some changes were needed to use the simulator and the UART for rc control.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-06-08 22:21:59 -07:00
tumbili
5c013af574 save gps data so driver can read 2015-06-08 22:21:59 -07:00
tumbili
45ee36234d activate sending thread only once got message from simulator 2015-06-08 22:21:58 -07:00
tumbili
f0a3210e94 major simulator rework:
- wait for first message from jMAVSim
  before sending data
- publish raw rc data coming from PIXHAWK (temporary)
- send some interesting messages to jMAVSim
- prepare sensor data for sim drivers to read
2015-06-08 22:21:58 -07:00
Mark Charlebois
ca88251124 Fixes for gcc 4.8
The use of a non-static function without a declaration generates a
warning for gcc 4.8.

Clang-3.4 does not work when compiling for gprof. The executable always
generates a segv.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-29 12:38:51 -07:00
Mark Charlebois
1ca05aaa64 orb_advert_t changed to void * and checks changed to nullptr
The existing orb_advert_t use thoughout the code sometimes tries
to treat it as a file descriptor and there are checks for < 0
and ::close calls on orb_advert_t types which is an invalid use
of an object pointer, which is what orb_advert_t really is.

Initially I had changed the -1 initializations to 0 but it was
suggested that this should be nullptr. That was a good recommendation
but the definition of orb_advert_t had to change to void * because
you cannot initialize a uintptr_t as nullptr.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-27 14:42:49 -07:00
Mark Charlebois
a734fc96d1 extensive orb_advert_t fixes
The calls to orb_advertise were being mishandled throughout the code.
There were ::close() calls on memory pointers, there were checks
against < 0 when it is a pointer to a object and values larger than
0x7ffffffff are valid. Some places orb_advert_t variables were
being initialized as 0 other places as -1.

The orb_advert_t type was changed to uintptr_t so the pointer value
would not be wrapped as a negative number. This was causing a failure
on ARM.

Tests for < 0 were changed to == 0 since a null pointer is the valid
representation for error, or uninitialized.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-27 14:41:33 -07:00
Mark Charlebois
ffdc9d629c POSIX: Improved logging
The warnx and warn calls map to PX4_WARN.
Calls to errx or err genrtate a compile error.

The px4_log.h file implements a new log format:

For DEBUG and INFO:
<level> <msg>

For ERROR and WARN:
<level> <msg> (file filepath line linenum)

The verbosity can be changed by setting the macro to use
either linux_log or linux_log_verbose in px4_log.h

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-19 09:19:24 -07:00
Roman Bapst
4a84215a8f fix mavlink message sending, make thread priority default 2015-05-15 17:49:20 +02:00
Roman Bapst
cf27fc59c7 read hil sensor message instead of highres imu message 2015-05-13 10:31:52 +02:00
tumbili
9686f8004e send pwm outputs to simulator 2015-05-12 23:55:32 +02:00
tumbili
3a79679e2d get manual control setpoint from PIXHAWK 2015-05-12 23:15:58 +02:00
Mark Charlebois
d0bf4ab449 Simulator: refactored mavlink additions
QuRT does not support UDP so moved the mavlink specific code
to a new file that is not built for the qurt target

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-11 19:25:11 -07:00