PX4FLOW spikes on data output

You need to get the standard python dev kit
sudo apt-get install python-dev

clone my repo
git clone https://github.com/patrickpoirier51/PX4Flow-Python-Test

cd /PX4Flow-Python-Test
sudo python test_px4flow.py

I managed to run the python script and I am reading none zero integer output. Although the values are quite hard to correlate to the actual movement of the board.

I agree but you should correlate the values changing from + to - when movng back-forth or left-right
So this is basically to show that PX4Flow on I2C works with RPI :wink:

Yeah I think it actually somehow make sense :slight_smile: At least i am not seeing spikes again and the signs are correct. Next I will update the apm version. any recommandation?

I think @LanderU instructions are OK == http://docs.erlerobotics.com/brains/pxfmini/software/apm/install_binaries#build-apm-using-waf-cross-compil-

git clone https://github.com/ardupilot/ardupilot
cd ardupilot/
git submodule update --init
./waf configure --board=pxfmini
./waf # to compile the code for all the vehicles

you need to specify the good board type:
./waf list_boards

Sorry for being such an amatuer, but where do I find the compiled .elf binary? Not locally, not under /tmp. :frowning:

BUILD SUMMARY
Build directory: /home/erle/waf_ws/ardupilot/build/erlebrain2
Target Text Data BSS Total

bin/arducopter 1094606 1188 36124 1131918
bin/arducopter-heli 1060350 1184 35948 1097482

Build commands will be stored in build/erlebrain2/compile_commands.json
’copter’ finished successfully (2m38.935s)

considering that you are already in the ardupilot directory, do
ls /build/erlebrain2/* and you should see the files

copy the quadcopter file in a proper place and launch the file manually:
sudo ./arducopter -C udp:10.0.0.1:14550

Note:
you may need to stop the old ardupcopter before
sudo top and hit ‘k’ to kill the ardupilot process (should be the defaulted number) , press enter and type 9 to kill it

Result:
Raspberry Pi 2/3 with BCM2709!
Found PX4Flow on bus 1
Found LidarLite device=0x6209 v2=1
The sensor are recognized :slight_smile:

and then after few seconds
: Segmentation fault … :frowning:

Segmentation fault on RPI is a known problem that should have been corrected on copter 3.5 release 7 (the lates from last week). Copter-3.5.0-rc7 is now available for beta testing
Make sure that you have compiled with the latest Master
Or check if you have t->thread->set_stack_size(1024 * 1024); on line 109 in this file: /ardupilot/libraries/AP_HAL_Linux/Scheduler.cpp

I do have that line in the file, not sure why it is happening. I cloned from master yesterday so should be fine.

Should i switch to the rc7 tag and compile again?

If you have the line you are up to date.
We might have to investigate further on this issue then, I will reopen the PR.
Meanwhile just make sure that you do not have 2 concurrent version running by looking at ‘‘top’’

I purged the erle ardupilot before and no ardupilot current running on top. Ardupilot indicator light not blinking. However I didn’t kill the rosnode mavros and gcs bridge, but I don’t know it’s related.

I asked @lucasdemarchi for advice on this issue, adding more memory in the stack size seemed to have resolved the issue (confirmed by Erle as well), but there might be something else.

I would be tempted to tell you to revert to an earlier stable like 3.4 but you will loose the Lidar Lite V3, unless you want to hack the code :wink:

The only thing I would recommend is that you flash a new memory card with a clean up to date Raspian and launch the arducopter on the Ethernet port, so all the other unknowns will be removed

Thanks for the advice! Don’t really want to lose the lidar lite. I will do a clean build and test the current master branch.

Cool,
I think your new build is fine ,so you can just copy the file on the new card and launch

you can check the version of the release with: grep --text APM:Copter arducopter

I have another brain 3 at hand so I copied the new build and ran arducopter.

After connecting to APM planner 2.0.25rc I found out:

— I can’t see any parameter in the full parameter list
— LidarLItev3 works
— optical flow measurement doesn’t appear
— When trying to enable optical flow from the checkbox, it turns off the next time I open apmplanner again.
the I2C can be detected via i2cdetect. (I have now both lidar lite v3 and px4flow on different I2C port)

I ran your python test script https://github.com/patrickpoirier51/PX4Flow-Python-Testand got non zero output.

Interestingly enough… I can’t choose the frame type either. I feel like I am missing some parameter file?

Yes you have to specify a frame class now http://ardupilot.org/copter/docs/frame-type-configuration.html

Are you sure that you flashed the firmware on the Px4Flow ?
http://ardupilot.org/copter/docs/common-px4flow-overview.html#upgrade-the-px4flow-sensor-s-firmware

This is what I am getting with the frame setup page.

Yes I did download firmware using qgroundcontrol.

I suggest you go through the steps using Mission Planner
@JD-ETH do you confirm that arducopter is stable (no Seg Fault) on your new system ?

Yes it looks like its running fine. Just can’t test the vehicle with apm planner, and don’t have a window laptop here. The px4flow still doesn’t seems to work though.

The parameter list issue comes from using router. after switch back to hotspot it works. The opt_flow outputs contant none zero value at flow_comp_m_x and flow_comp_m_y, and the rest is zero. The ground_distance is taken from the lidar lite now. I am seeing hope :slight_smile: Currently on 3.6-dev

I see this appearing repeately
[MAV 001:1] EKF2 IMU0 is using optical flow
[MAV 001:1] EKF2 IMU0 has stopped aiding
This keeps appearing

you can kill the process, sudo systemctl stop ros.service in order to disable sudo systemctl disable ros.service.

Regards,

@LanderU