PX4FLOW & position hold

Info and discussion about the autonomous Micro FC, suitable for nanos, micros and mini multirotors

PX4FLOW & position hold

Postby Matthew » Sun Aug 16, 2015 9:55 pm

Hi

I'm looking for a way to achieve precise position hold with M4 controller and without GPS signal (indoor). I figured the best bet would be PX4FLOW sensor. But is it still supported in AQ firmware? How much work would it be to achieve a good result? I do have some electronics skills but not as much programing experience.

The second thing I'd like to achieve is hover and position hold without radio in the system. Possibly drone would be placed anywhere in space, user would push a button, motors would start to work and M4 would try to hold the position given by PX4FLOW sensor. Is this achievable? To be frank over 200 files of AQ firmware looks a bit scary and I don't know where to start.
Matthew
 
Posts: 14
Joined: Sun Aug 16, 2015 9:10 pm

Re: PX4FLOW & position hold

Postby kinderkram » Mon Aug 17, 2015 11:28 am

Bill and Peter have played with PX4flow some time ago with AQ6 and M4:




And there have been tests with LIDAR for position hold and obstacle avoidance:

kinderkram
 
Posts: 2911
Joined: Fri Jun 22, 2012 7:47 am

Re: PX4FLOW & position hold

Postby Matthew » Mon Aug 17, 2015 3:17 pm

Thank you for the answer :) I have seen the first video along with Bill's topic on the forum. The results are great but is there any instruction how to achieve that? Is connecting M4 USART port with PX4FLOW USART port enough? Which firmware version should I download?
Matthew
 
Posts: 14
Joined: Sun Aug 16, 2015 9:10 pm

Re: PX4FLOW & position hold

Postby sandmen » Mon Aug 17, 2015 3:26 pm

Matthew wrote:Thank you for the answer :) I have seen the first video along with Bill's topic on the forum. The results are great but is there any instruction how to achieve that? Is connecting M4 USART port with PX4FLOW USART port enough? Which firmware version should I download?


It is nearly enough to connecting the px4flow. Some small code changes and you are done, for getting the px4flow
and AQ working. But that means only "working". Adjusting the px4flow for your conditions is very important.
For position-Hold is also very important that the vibrations are very low.... Other wise you will see a drift or a "unstable" pos-hold.
The px4flow, "replace" the GPS !
So, currently it's not implemented as a "second" position-system.
In my experience, the px4flow, has maybe not the best "sensors".
The sensors are ok, but not very good.
The flow sensor, is very light sensitive, and the ultrasound is very fast out of range...
So, you can only fly with ~1m/sec in DVH, other wise ultrasound will loose the altitude.
sandmen
 
Posts: 997
Joined: Fri Jun 22, 2012 7:25 am

Re: PX4FLOW & position hold

Postby Matthew » Mon Aug 17, 2015 5:11 pm

Great, practical advice :) Actually I don't mind losing GPS. Applications I consider are both outdoor and indoor and position hold accuracy have to be independent from GPS signal. The only maneuver the drone will perform is precise position hold. No intentional flying up/down/forward/backward, just staying in one place about 1,5 m above the ground. PX4FlOW seems to be perfect for that task.

I didn't thought about vibrations but after what you wrote I'll definitelly work on minimising them.

Some small code changes and you are done, for getting the px4flow
and AQ working. But that means only "working". Adjusting the px4flow for your conditions is very important.

Could you please explain what you meant? Some changes to the UKF? Should I adjust PX4FLOWs source code?
Matthew
 
Posts: 14
Joined: Sun Aug 16, 2015 9:10 pm

Re: PX4FLOW & position hold

Postby sandmen » Thu Aug 20, 2015 6:22 pm

Only some lines in AQ....
Need to check that.
Otherwise, on Px4Flow, Bill's changes are already in the official FW.
sandmen
 
Posts: 997
Joined: Fri Jun 22, 2012 7:25 am

Re: PX4FLOW & position hold

Postby Matthew » Thu Jan 21, 2016 2:17 pm

Hi

I guess there is no need to create new topic. My quad finally flies. It turned out that PX4FLOW really works out of the box. You just have to connect UART.

Unfortunatelly I experience a significant, horizontal drift in position hold. It has a rather constant speed of 20 cm/s. All test I do are indoors, and every time, after about 5 seconds I have to land the quad to prevent it from crashing on the wall. Please help me resolve that problem.

First of all I couldn't find any information on how to calculate UKF_FLOW_ROT parameter. My AQ is fliped around Y axis, while PX4FLOW is mounted like in this picture https://pixhawk.org/_media/modules/px4f ... tok=8dfdcf with front of the quad on top of the picture. I tried all 4 angles (0, 90, 180 and -90) but there is a drift every time. Once I connect AQ to QGC, move the drone above the ground and observe position on the screen it seems to don't change logically. It only works well if I hold the quad fery still.

It would probably be much easier to diagnose the problem once wireless telemetry would be working. I have a bluetooth module but UART on AQ is connected to FLOW sensor. I found an information that there is a second UART but if I am correct it's on the same pins as PWM output which is used to connect KISS esc. GPS module is not used in my setup so theoretically I could desolder the module and use it's UART. Would that work? What changes to the code shall I make?

Before tests I performed tare leveling, IMU calibration without temperature calibration and changed PID values for tilt and YAW.
Matthew
 
Posts: 14
Joined: Sun Aug 16, 2015 9:10 pm

Re: PX4FLOW & position hold

Postby Matthew » Sun Jan 24, 2016 7:17 pm

Ok I made a progress in the subject of telemetry over bluetooth. I discovered that external esc can be connected through ports 1 - 4. So I switched connections from ports 5 - 9. They work like a charm. By doing so UART6 become accesible. I soldered bluetooth module but it doesn't seems to work. The problem is very similar to the one described in this subject viewtopic.php?f=33&t=4389 . I have already tried switching TX <-> RX cables and tried both COM ports in QGC.

In board_m4_r6.h I found the line "//#define COMM_PORT3 USART6" and uncommented it. This change alone didn't make bluetooth work. Are there any other changes neccesary to enable UART6? Or is there some other solution?
Matthew
 
Posts: 14
Joined: Sun Aug 16, 2015 9:10 pm

Re: PX4FLOW & position hold

Postby Max » Sun Jan 24, 2016 10:23 pm

Matthew wrote:In board_m4_r6.h I found the line "//#define COMM_PORT3 USART6" and uncommented it.


I think you will also need to set some params manually (QGC All Params view):

COMM_STREAM_TYP3 = 2 (for mavlink)
COMM_BAUD3 = 115200 (or whatever)

I haven't tried this yet, but it should work. M7 port (J2.10, PC6) becomes Tx and M8 (J1.10, PC7) becomes Rx.

EDIT: Alternately, uncomment COMM_PORT2 in the board header file instead and set it to USART6

Code: Select all
#define COMM_PORT2          USART6


This should let you use QGC 1.6 Misc. tab to make the settings.

-Max
Max
 
Posts: 2814
Joined: Mon Aug 13, 2012 9:45 pm
Location: Near Ithaca, NY, USA

Re: PX4FLOW & position hold

Postby Matthew » Sun Jan 24, 2016 11:39 pm

Thanks. I've just tried both solutions but they didn't work. They are a step in the right direction for sure but there has to be something else blocking the connection.

Do I have to disable the definition of those pins as PWM outputs? I commented all definitions up to #define PWM_IC_IRQS like that:
Code: Select all
#define PWM_TIMERS  const TIM_TypeDef *pwmTimers[] = { \
    TIM3, \
    TIM3, \
    TIM4, \
    TIM4, \
    TIM4, \
    TIM4, \
    //TIM8, \
    //TIM8, \
    TIM9 \
};

But ended up with some strange errors during building process.
Matthew
 
Posts: 14
Joined: Sun Aug 16, 2015 9:10 pm

Next

Return to AutoQuad M4 Micro Controller

Who is online

Users browsing this forum: No registered users and 1 guest

cron