32 Commits

Author SHA1 Message Date
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
Lorenz Meier
9882b78383 Merge pull request #2248 from mcharleb/gyrosim-fix
Gyrosim: Fixed constant looping
2015-06-02 01:40:49 -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
2d85578599 Gyrosim: Fixed constant looping
Gyrosim would call measure continuously because the write_checked_reg
was failing. There is no need to check faked reg writes in the
simulator so that code was removed.

The delay that was added to the simulator to pace the gyrosim reads
was also removed now that the source of the problem was determined.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-28 11:20:30 -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
f1f562a94d POSIX: Fixed orb_advertise failure
There were an insufficient number of devmap entries allocated and
when they ran out, new orb_advertise requests would fail.

Also added a new logging macro for the Linux build to show the
calling pthread if enabled.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-21 15:35:11 -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
Mark Charlebois
2d32395bc0 Merge branch 'qurt' into linux 2015-05-11 16:07:53 -07:00
Mark Charlebois
a99f916bdf POSIX: Changed px4_debug.h to px4_log.h
Also changed use of printf to PX4_WARN or PX4_INFO in posix and
qurt tests.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-11 16:04:39 -07:00
tumbili
c074d6e913 implemented polling of socket file descriptor and uorb topic file descriptor 2015-05-11 23:55:11 +02:00
tumbili
9119687177 make socket non-blocking, moved socket includes to header file to avoid forward declarations 2015-05-09 10:35:25 +02:00
tumbili
39711ca908 implemented bidirectional udp communication with simulator 2015-05-08 21:51:21 +02:00
Mark Charlebois
872e1ebda0 GCC fixes for warnings
GCC was more picky about prototypes for inlines being required.

The generate_listener.py script used incorrect printf formats and
was casting %f params to float, but printf casts all %f params to
double per the spec.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-06 11:45:23 -07:00
Mark Charlebois
0cea93a55c POSIX and QuRT: fixed calls needing px4_ prefix
There were some missed calls to open and ioctl that need to be
px4_open and px4_ioctl.

QuRT also does not provide usleep() so px4_time.h has to be included
in files calling usleep.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-05-05 12:13:39 -07:00
tumbili
17267a7f66 enable receiving mavlink highres imu message (via udp) from external simulator 2015-05-04 23:10:23 +02:00
Mark Charlebois
93a3eeb569 Simulator: Added Roman's sensors combined topic
Simulator can work as before with -s flag or with Roman's additions to
publish the sensors combined topic using -p flag.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-29 23:45:54 -07:00
Mark Charlebois
09718fa324 Revamped debug macros
Created px4_debug,h to define:

PX4_DBG
PX4_INFO
PX4_WARN
PX4_ERR

These enable OS specific mappings to be made, filtering, etc.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-27 21:58:54 -07:00
Mark Charlebois
58a33dd26a Added simulated tone_alarm and enabled led for POSIX
Added simulated tone_alarm class and enabled led class for posix build.

The simulator implements the led_init, led_on, led_off, led_toggle calls.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-27 14:00:06 -07:00
Mark Charlebois
3336fce1f4 QuRT and POSIX changes
Partial commit of the changes for QuRT and related changes for POSIX

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-24 00:52:44 -07:00
Mark Charlebois
88dc6ec1e5 Simulator: use template for Reports
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:37:50 -07:00
Mark Charlebois
93c39e6d1d Linux: Added barosim support to simulator
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:37:50 -07:00
Mark Charlebois
89bc1b86b2 Linux: connected gyrosim to Simulator
Simulator gets incoming MPU data and gives raw MPU data to the
gyrosim sensor when read.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:37:50 -07:00
Mark Charlebois
ac1679dbc3 Added simulator
Simulator listens for UDP input data at port 9876.

Data is for now comma separated. Not yet connected to the various sim
classes: accelsim, gyrosim, magsim.

Barometer measurements not yet supported.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:35:49 -07:00