LibrePilot Forum

Development => Firmware General => Topic started by: jdl on July 03, 2019, 01:24:40 pm

Title: Librepilot & tBeacon (Revolution FC)
Post by: jdl on July 03, 2019, 01:24:40 pm
I've recently built / DIY few tBeacons to add as a kind of insurance to my UAVs :)

https://tbeacon.org/?page=6&language=en (https://tbeacon.org/?page=6&language=en)

There is an issue when connecting them to uBlox7/8 GPS that is autoconfigured by Revolution FC. tBeacon cannot get GPS coordinates at all.

The problem is in the tBeacon code, it simply doesnot parse ublox7 UBX_NAV_PVT message. I recall the creator of tBeacon had mentioned somewhere in the related RCGroups thread that this may/will be added in next firmware.

Meanwhile, I resolved the issue by simply enabling necessary NAV_POSLLH & NAV_SOL messages in the ubx_autoconfig.c module.

Code: [Select]
ubx_cfg_msg_t msg_config_ubx7[] = {
    // messages to disable
    { .msgClass = UBX_CLASS_NAV, .msgID = UBX_ID_NAV_AOPSTATUS, .rate = 0  },
    { .msgClass = UBX_CLASS_NAV, .msgID = UBX_ID_NAV_CLOCK,     .rate = 0  },
    { .msgClass = UBX_CLASS_NAV, .msgID = UBX_ID_NAV_DGPS,      .rate = 0  },
    { .msgClass = UBX_CLASS_NAV, .msgID = UBX_ID_NAV_POSECEF,   .rate = 0  },
    { .msgClass = UBX_CLASS_NAV, .msgID = UBX_ID_NAV_SBAS,      .rate = 0  },
    { .msgClass = UBX_CLASS_NAV, .msgID = UBX_ID_NAV_TIMEGPS,   .rate = 0  },
    { .msgClass = UBX_CLASS_NAV, .msgID = UBX_ID_NAV_VELECEF,   .rate = 0  },
    { .msgClass = UBX_CLASS_NAV, .msgID = UBX_ID_NAV_STATUS,    .rate = 0  },
    { .msgClass = UBX_CLASS_NAV, .msgID = UBX_ID_NAV_VELNED,    .rate = 0  },
    { .msgClass = UBX_CLASS_NAV, .msgID = UBX_ID_NAV_TIMEUTC,   .rate = 0  },
 
    { .msgClass = UBX_CLASS_MON, .msgID = UBX_ID_MON_HW,        .rate = 0  },
    { .msgClass = UBX_CLASS_MON, .msgID = UBX_ID_MON_HW2,       .rate = 0  },
    { .msgClass = UBX_CLASS_MON, .msgID = UBX_ID_MON_IO,        .rate = 0  },
    { .msgClass = UBX_CLASS_MON, .msgID = UBX_ID_MON_MSGPP,     .rate = 0  },
    { .msgClass = UBX_CLASS_MON, .msgID = UBX_ID_MON_RXBUFF,    .rate = 0  },
    { .msgClass = UBX_CLASS_MON, .msgID = UBX_ID_MON_RXR,       .rate = 0  },
    { .msgClass = UBX_CLASS_MON, .msgID = UBX_ID_MON_TXBUF,     .rate = 0  },

    { .msgClass = UBX_CLASS_RXM, .msgID = UBX_ID_RXM_SVSI,      .rate = 0  },

    // message to enable
    { .msgClass = UBX_CLASS_NAV, .msgID = UBX_ID_NAV_PVT,       .rate = 1  },
    { .msgClass = UBX_CLASS_NAV, .msgID = UBX_ID_NAV_DOP,       .rate = 1  },
    { .msgClass = UBX_CLASS_NAV, .msgID = UBX_ID_NAV_SVINFO,    .rate = 10 },

    // enable for compatibility with tBeacon 0.56EN, for 5Hz GPS refresh rate
    { .msgClass = UBX_CLASS_NAV, .msgID = UBX_ID_NAV_POSLLH,    .rate = 5 },
    { .msgClass = UBX_CLASS_NAV, .msgID = UBX_ID_NAV_SOL,       .rate = 5 },

    };

Thus, for 5Hz UBX refresh rate, these messages will come once a second. That is what the tBeacon firmware expects with its default settings.

I've made more than a dozen flights with modified firmware on a quad and two planes and all is fine. Extra enabled messages do not swamp the bandwidth. Further, they are ignored by Revolution code when NAV_PVT is enabled so no harm at all.

The tBeacon itself is happy and readily reports GPS coordinates :)
Title: Re: Librepilot & tBeacon (Revolution FC)
Post by: TheOtherCliff on July 03, 2019, 07:36:47 pm
For others, a fix with no code changes at all:

First, using flight battery power (so GPS is powered) and GPS plugged into Revo, set the Settings->GPSSettings->UbxAutoConfig to AutoBaudConfigureAndStore.  Within a few seconds (say 30 to be safe) that will store the needed Revo settings inside the GPS in non-volatile memory.  Auto config is done when DataObjects->GPSPositionSensor->AutoConfigStatus is "Done" (not Error, Disabled or Running).

Second, permanently set (use red up arrow) the GPSSettings->UbxAutoConfig to AutoBaud so it will never reconfigure the GPS.

Last, use the Ublox Ucenter program to add GPS settings needed by tBeacon to the GPS (without erasing the Revo GPS settings already stored in the GPS).

-----------------------

I'm a little confused.  ???  Wouldn't Revo's built in OpLink give you GCS telemetry based GPS coordinates using the laptop and OpLink you might already have?  And show it to you on a map too?  Maybe this is an issue with OpLink 433MHz not being legal where you are but FRS radio (modern walkie talkie) is legal without a license, or wanting a simpler backup device that is more survivable in a crash, or wanting to carry the smaller UHF handheld radio when walking.  I find :( that the flight battery is usually the first thing to eject in a crash, so powering any onboard beacon is an issue.  Ahh, I see that RCGroups has a thread that says that it has it's own battery.

FYI: for the soldering inclined that want a different OpLink frequency because of their country's laws, 'Next' has support for 433, 868, and 915 MHz if you just ( :) ) replace your OpLink RF modules.

And another enhanced OpLink (Revo with OpLink+ code) project:
When walking toward a lost aircraft, use OpLink telemetry or entered last known coordinates with handheld Revo's GPS and compass to move a servo arm to always point toward the lost aircraft.  A dedicated finder box running some new firmware.

Imagine that this is built into standard Revo code.  You have a fixed wing with Revo and GPS.  Just boot it with a jumper from output 5 to output 6 and it will use the rudder and aileron servos to tell you where to go as you walk.

Or just code up "follow me" to do something similar between two Revo/GPS aircraft and use that to fly there or guide you when walking.  Leader broadcasts it's GPS coordinates.  Follower plugs these into it's HomeLocation and uses TakeOffLocation for an offset.
Title: Re: Librepilot & tBeacon (Revolution FC)
Post by: jdl on July 03, 2019, 09:40:13 pm
I agree with you, Cliff.

The manual configuration method using Ucenter was the first thing I did, at least to find what exact NAV messages the tBeacon needs. Anyway, I wasn't happy enough with this solution and decided to dig a little in autoconfig code.

Still, the manual GPS config is absolutely fine solution if anyone want to add tBeacon to his Revolution FC based UAV without rhe need to compile his own modded firmware.

----

About tBeacon:

I'm already using OPLINK @ 433MHz in all my Revo equipped UAVs for radio control and telemetry. I consider it, for myself, to be a reliable LRS, it matches all my current needs, allows stable telemetry with stock 100mW Revo onboard RFM22B module up to 11-13km with omnidirectional antennas (in relatively clean RF environment - away from big cities, for example). I use reworked OPLINK Minis with (further modified for more output power) RFM23BPS radio modules in 2.4GHz-to-433MHz relays for control and still have to reach their real limits. Some day I may try, out of curiosity... ;) Anyway, I think 1W Tx power @433MHz is pretty enough, I keep "turbo" Tx power mode on a switch for emergency only. Had used it only once for a minute or two.
Sorry for off-topic...

The standard OPLINK frequences (430-440Mz) are legal in my country and I have the necessary license. 446MHz PMR walkie-talkies are allowed even without a license. 868MHz and 915MHz frequences are illegal, however! :)

The idea behind tBeacon is that it is a fully autonomous device with its own battery that can last in standby mode at least for a week. Even without the last recorded GPS position, tBeacon can be used to locate the crashed aircraft by simple 'fox-hunting'-like tracking with the help of a directional antenna on the handheld radio. It also announces the RSSI of the received signal when being called/waked up.

If the crash is not that severe to demolish the tBeacon itself, and it is connected to the onboard GPS, it will have and will report when called later the last ever parsed GPS location, just before impact with the ground or even after that, if the onboard UAV battery is not ejected and the GPS sees enough sats. If the crash happens far away from the control OPLINK, let's say 5-10km or more, the back telemetry will break when the aircraft is still hundreds of meters above ground and the last transmitted by telemetry GPS position would not match the real crash site. I had such a mishap when a servo died in a elevon type fixed wing (Z-84) and it crashed uncontrollably more than 6km away from me. Last GPS position I could retrieve from OPLINK telemetry record was when the falling plane was 190m above ground. I could find a single video frame with visible GPS coordinates from FPV camera DVR record at 150m above ground. The real crash site was 250m+ away (in horizontal direction) from this last retrieved position. I had a luck that nice people found the crashed plane and called me back (I had put my phone number on the bottom of the plane).

If I had a tBeacon onboard in this occasion, I could simply call it with the handheld radio when I had arrived in closer range (1-2km or even more) from the approximate crash position (from telemetry) and just walk to the tBeacon reported (by speech) real crash GPS coordinates. Or just use classic triangulation based location finding with a yagi attached to the handheld radio.

Btw, tBeacon uses RFM22B module for analog signal transmission that outperforms digital packet based communication for the purpose, I presume. I use Baofeng UV-5R radio with stated sensitivity of -130dB. Much, much more than the  -87dB (my personal experience) of OPLINK (RFM22B or RFM23BPS) @ 57600bps.

Title: Re: Librepilot & tBeacon (Revolution FC)
Post by: TheOtherCliff on July 04, 2019, 03:51:21 am
For clarity, the method I described doesn't need you to know anything about the GPS message types needed by Revo.  Setup for the message types needed by Revo gets stored in non-volatile setup memory in the GPS.

You only have to know what message types the beacon needs and add those (using u-center) to the Revo message types already stored in the GPS.

Finally, changing a setting in Revo means that Revo will no longer configure the GPS at each power up, but will run with the GPS settings you have carefully set up inside the GPS.