-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Added px4fmu_sim branch for software in the loop (SITL) development #44
Conversation
Here is the current status of the sitl. I have a few more apps turned on, namely: systemlib, systemlib/mixer, systemcmds/mixer: ~/git/px4/src/Firmware$ ./Images/px4fmu_sim.exe
NuttShell (NSH)
tone_alarm [2:100]
[init] looking for microSD...
nsh: mount: mount failed: 2
[init] no microSD card found
[init] script /fs/microsd/etc/rc not present
nsh: sercon: command not found
[init] No USB connected
[init] detecting attached hardware...
nsh: boardinfo: command not found
[init] PX4IOAR not detected
nsh: boardinfo: command not found
[init] PX4IO not detected
[init] no expansion board detected
[init] reading /etc/init.d/rc.standalone
[init] doing standalone PX4FMU startup...
nsh: uorb: command not found
nsh> |
On Nov 3, 2012, at 10:25 PM, James Goppert wrote:
From looking at your tree, it looks like you've added a new architecture called "sim" which looks like it serves the same basic purpose as the NuttX RGMP config, i.e. you're building a Linux app that behaves like the PX4 firmware.
= Mike
|
I'm using the default nuttx sim arch. The only thing that I had to modify is add a copy of the linux math.h that has the arm #define constants for M_PI_2_F etc. Because of this change I renamed the arch to arm_sim. I am running the nsh config and turning on the other apps for px4 one at a time. Currently I am trying to turn on the uOrb app but running into some undefined references: uORB.cpp:(.text+0x8de3): undefined reference to `hrt_absolute_time' I will probably need some help to get all of the drivers online. I have started putting the drivers in drivers/sitl, I think drivers/arm_sim might be a better choice so I'll change that. |
On Nov 4, 2012, at 4:26 PM, James Goppert wrote:
It is a mistake to call it "arm_sim", as there is nothing ARM-y about it. The change you've made to the NuttX sim arch to add math.h doesn't justify forking it; just add it the same way we did to the armv7 arch. = Mike |
Yes, will be much better if we can keep the nuttx sim/arch clean. I'll look into what you did for armv7. |
Currently most of sitl is working. I have yet to do the simulation interface. Right now I am struggling getting the param setup to work correctly. I think the errors are related to variables referenced by the ld script. I am working on understanding the ld.script more. I got the memory section up with this: MEMORY
{
flash (rx) : ORIGIN = 0x00000000, LENGTH = 10M
sram (rwx) : ORIGIN = 0x10000000, LENGTH = 10M
ccsram (rwx) : ORIGIN = 0x20000000, LENGTH = 10M
} It was running out of flash with the current build in sim so I just gave it plenty of space. I'm not sure why the __param_start isn't working correctly Starting program: ~/git/px4/src/Firmware/Images/px4fmu_sim.exe NuttShell (NSH)
[init] looking for microSD...
nsh: mount: mount failed: 2
[init] no microSD card found
[init] script /fs/microsd/etc/rc not present
nsh: sercon: command not found
[init] No USB connected
[init] detecting attached hardware...
nsh: boardinfo: command not found
[init] PX4IOAR not detected
nsh: boardinfo: command not found
[init] PX4IO not detected
[init] no expansion board detected
[init] reading /etc/init.d/rc.standalone
[init] doing standalone PX4FMU startup...
[uorb] ready
[init] eeprom
nsh: eeprom: command not found
nsh> commander start
commander start
commander: param base: 80f9490, limit 80f9494, start 34, end 658: Unknown error
Program received signal SIGSEGV, Segmentation fault.
0x0805ba3d in param_find (name=0x80db1fc "SYS_FAILSAVE_LL")
at /home/jgoppert/git/px4/src/Firmware/apps/systemlib/param/param.c:208
208 if (!strcmp(param_info_base[param].name, name))
(gdb) backtrace
#0 0x0805ba3d in param_find (name=0x80db1fc "SYS_FAILSAVE_LL")
at /home/jgoppert/git/px4/src/Firmware/apps/systemlib/param/param.c:208
#1 0x08099c1d in commander_thread_main (argc=1, argv=0x820080c)
at /home/jgoppert/git/px4/src/Firmware/apps/commander/commander.c:1168
#2 0x0804a214 in task_start ()
at /home/jgoppert/git/px4/src/Firmware/nuttx/sched/task_start.c:113
#3 0x00000000 in ?? ()
(gdb) |
It was the "ABSOLUTE(.)" within the param section of the linker script, had to be just ".". I'm guessing I might have to remove some more ABSOLUTE flags in other sections. nsh> commander start
commander start
[commander] I am in command now!
[commander] new state: SYSTEM_STATE_PREFLIGHT
nsh> |
What is the current state of this branch? Is there a plan for the uORB implementation? |
All of the apps are compiling. Right now I have host tcp hooked up to the fake serial device and am trying to figure out why packets aren't coming to the host as expected. There is an empty sensor class that I will put another tcp connection in. Hrt code is there but not checked. Seems loops don't start till I cntrl-c the main process. I haven't tried to debug uORB yet. I know that it is at least starting and runs without segfaults. |
Currently I'm trying to get my sleeping processes to wake. The docs say that the sim arch doesn't support a real timer or interrupts so I'm assuming this is related. I see however no reason why timer/ interrupt support can't be added. I sent Greg Nutt an email so maybe he can help. |
I haven't heard from Greg yet, but I think the issue here is that there is no real multi-threading. So since nsh is in the foreground waiting for command line input nothing happens. I fixed this temporarily by just not allowing user input on nsh. In the long term, maybe we can get true multi-threading running for sitl. |
Mavlink packets are coming in on tcp and it works with mavproxy. Now I just have to hook up the JSBSim tcp interface to the sensors app. First I start the px4fmu simulation.
The simulation is now waiting for a tcp connection so we start mavproxy in another terminal.
Now the init procedure continues and starts the commander app.
|
Right now I modified the rc.standalone script to call commander start etc, so this will have to be cleaned up before merging it. |
That doesn't actually make any sense; if it's waiting for input it's not in the foreground, it's blocked. On Nov 26, 2012, at 7:54 AM, James Goppert notifications@github.com wrote:
|
It calls host fread which blocks until it receives input. But it can't execute any other process until fread returns. Greg said I would have to rewrite dev_console so it doesn't block. |
I setup the uORB test so that it checks across multiple processes. It appears that it is working on sitl. I'm not sure why the memory layout isn't affecting uORB when compiled on linux. There is still an error between the ekf and sensor app communication with uORB on sitl that I am working out, but it must be unrelated. |
I fixed a bunch of HIL / mode enable issues in the fixedwing_outdoor branch. Can you update this branch, merge the two and report back the status? Please do not submit the merged version here, as we don't want to pull in all at once. |
James; do you still want this? |
It needs a lot of work that I can't put into it right now. It would be a good starting point for anyone that does have time, but we can close the pull request. Maybe we should just add the branch to PX4 repo so people see that it does exist and they don't reinvent the wheel. |
Ok; thanks for the update - I'll leave the pull request here for now and look for someone that's interested in working on it. |
Closing this, as we focus on ROS-based SITL now, which also allows a ROS native port. |
NuttX: - https://github.com/PX4-NuttX/nuttx/tree/master - PX4/NuttX@973938d Changes from PX4/NuttX (PX4/NuttX@9331fda) in current PX4/master (fc9df31) PX4/NuttX@9331fda...973938d 973938dc1a (HEAD, origin/master) Merge branch 'master' of bitbucket.org:nuttx/nuttx c5e25dc259 Merge branch 'master' of github.com:apache/incubator-nuttx 9d5d60f Run all .c and .h files in last PR49 through nxstyle. a8d63c0 various fixes (#49) 077ef70 cxd56xx improvements (#48) c5090d3 Merge branch 'master' of github.com:apache/incubator-nuttx 1c53d2b Nxstyle checkpatch support (#47) 4ea49c5 Fix issues on fe310 including interrupt handling (#46) 926a41f bcm43xxx: correct typo error to fix build break in photon board (#45) aad99a5 Fix typo in the file_read description (#44) Apps: - https://github.com/PX4/NuttX-apps/tree/master - PX4/NuttX-apps@74ba8ff Changes from PX4/NuttX-apps (PX4/NuttX-apps@91b6ad6) in current PX4/master (fc9df31) PX4/NuttX-apps@91b6ad6...74ba8ff 74ba8ff2 (HEAD -> master, origin/master) Merge pull request #5 from xiaoxiang781216/fix-void-cast f00b4e6f Merge pull request #4 from xiaoxiang781216/fix-suffix 85715845 Unify the void cast usage 6a65664c Application.mk remove _main suffix from REGLIST 73e1696e Merge pull request #3 from xiaoxiang781216/builtin 7a645baa Add .updated target to handle the no builtin app case correctly 8c8c4813 fix builtin_list.c:58:10: fatal error: builtin_proto.h: No such file or directory (#2) 64bc8f5b Run all .c and .h files modified in last PR through nxstyle. 49c99750 Wapi simplify (#1) 0536c5b5 apps/nshlib/nsh_parse.c: Correct an error found in build testing. Commit 2a462c78aa5f4ea6dc374eedd86bc85f9f79a0c4 was insufficient. It was a mistake to revert Xiang's change of commit 9defae8af641752506d92b72ea68c8f94d24d580. But we are on a different vector now.
…sor-in-ekf closes PX4#44
HITL in Docker updates
I have created a new config under nuttx/config/px4fmu_sim. This builds the nsh console for px4 using the standard linux gcc toolchain. It then creates a virtual romfs and runs the px4 startup script. I wanted to get some feedback from the other developers before going any further. So please let me know what you guys think.
My main question is where should the SITL drivers go. I see that recently all of the code was moved out of nuttx/configs/px4fmu/src to apps/drivers/stm32. Should I create a folder in apps/drivers/sitl? It seems like the nuttx way would be to keep it under configs/px4fmu_sim/src but I can see how that is cumbersome.
Also, if anyone else has interest in helping to develop the SITL drivers, help would be appreciated. Luckily the default nuttx sim arch has a lot of the work done already.