LPS Node as Tag and Anchor

All discussions related to the Loco Positioning system
HuzayfaaN
Beginner
Posts: 14
Joined: Mon Nov 26, 2018 2:20 pm

LPS Node as Tag and Anchor

Post by HuzayfaaN »

Hi All,

I'm currently working on a Final-Year Project at University and using the Crazyflie 2.0 along with its decks and primarily the LPS. I wanted some insight on if whether what we have in mind is feasible and can be achieved.

We are looking to interchange the configuration mode of the LPS Nodes (between an Anchor and Tag) during flight with the Crayflie 2.0, so that we can achieve a moving LPS environment.

So, to explain this further and for clarity, we intend to start with a specific configuration (as we would with the LPS) and provide manoeuvrability to each of the six anchors. All six nodes would never move together, but rather each one would move in turn respectively - to either expand the defined space or shift the boundaries (i.e. move the LPS defined environment along a corridor or room). As of my current understanding, to move a LPS node it would now need to be configured as a tag, so that it can reference the other anchors and move accurately within the initially configured LPS environment. Once it has reached its new location, I would like it to hold position and now behave as an Anchor. This process would be repeated with the next LPS Node and so on, and all this would be happening whilst the Crazyflie 2.0 is in flight (using the LPS configuration to progress with that flight).

Any help or guidance would be very much appreciated!

Thanks in advance for your support! :D

Huzayfaa
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: LPS Node as Tag and Anchor

Post by arnaud »

Hi Huzayfaa,

This should be technically feasible, though I can think of a couple of things to look at/think about.

The first one is that you need two tag to work simultaneously in your system. For this you will need either one of the TDoA mode or TWR-TDMA (a TWR mode that uses TDMA timeslots to avoid collision). If you only have 6 anchors and you want to switch one off some time TWR would seem better though TWR-TDMA is not the most tested things now that TDoA2/3 is stable. The problem of TDoA is that you need to be within the anchor convex hull to get good performance, one way could be to add a Z-Ranger to the Crazyflie which allows to get good performance as long as you are in the horizontal convex hull (Z is estimated from the z-ranger and X/Y from the LPS), the Crazyflie EKF should handle that pretty much out of the box.

Then, to switch the anchors in tag mode you need a tag implementation in the nodes. For TWR there is a tag implementation that does not support TDMA (could be ported from Crazyflie easily) and outputs ranges. For TDoA the sniffer mode can be use to implement a tag. The problem is that there is no position estimation implemented in the LPS nodes and so you will need to implement a full tag and the position algorithm for it. To some extent it can be ported from the Crazyflie but the nodes have a much weaker CPU so it should be made carefully (maybe accumulating readings and then estimating position out of them as a batch rather than real time positioning). In that sense the easiest would be to use Crazyflies as Anchor and switching them to tag when they need to move (as a bonus they might even be able to move by themselves ;). Porting the anchor code to the Crazyflie would be much easier and straightforward than porting the tag code to the nodes.

I hope that helps you get going, do not hesitate if you have mode questions. Also please update us of your progress if you can, this is a really interesting concept :).

/Arnaud
HuzayfaaN
Beginner
Posts: 14
Joined: Mon Nov 26, 2018 2:20 pm

Re: LPS Node as Tag and Anchor

Post by HuzayfaaN »

Hi Arnaud,

Thanks a lot for the detailed reply.

Most of it I understand and will now start looking into the concept in more detail.

And sure, I will keep you guys posted :)

Huzayfaa
lillyclark
Beginner
Posts: 1
Joined: Sun Sep 15, 2019 1:26 am

Re: LPS Node as Tag and Anchor

Post by lillyclark »

arnaud wrote: Wed Dec 05, 2018 9:04 am
The problem is that there is no position estimation implemented in the LPS nodes and so you will need to implement a full tag and the position algorithm for it. To some extent it can be ported from the Crazyflie but the nodes have a much weaker CPU so it should be made carefully (maybe accumulating readings and then estimating position out of them as a batch rather than real time positioning). In that sense the easiest would be to use Crazyflies as Anchor and switching them to tag when they need to move...

Arnaud,

According to the purchase page, the Loco Positioning Node "can be used as a standalone system with some Nodes acting as Anchors and one or more nodes acting as Tags." However you mentioned there isn't a full tag and position estimation implementation in the Nodes. Has the product/firmware changed since this post, or should I be hesitant to only buy Nodes for my system? Like OP, I'd like to change functionality from tag to anchor during operations.

Second, the LPS tutorial shows how to configure the system from the Crazyflie client - is it possible to configure the system without a Crazyflie (i.e. if I only have Nodes)?

Thanks!

Lilly
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: LPS Node as Tag and Anchor

Post by arnaud »

Hi Lilly,

LPS has been originally developed, and is still to some extent, for positioning the Crazyflie. Though technically the nodes can also be tags and so we added some functionalities to the nodes to be used as tag. But since the nodes have no IMU and they have a quite weak MCU, they cannot run full positioning algorithm like the Crazyflie does.

The current state of the node as tag is:
- For TWR (ie. to use a single tag in the system): the node can range with anchors an output ranges on its USB serial port
- For TDoA (ie. to use as many tag a you want): The node can act as a sniffer reporting packet timestamps and data. This is enough information to implement TDoA algorithms in an external system.

Things could be improved by adding TDoA decoding in the node, but there will always be a need to implement positioning and sensor fusion outside so the intention is to integrating in another system sensor fusion.

Recently we released the Roadrunner, a dedicated tag that contains the same CPU and IMU as the Crazyflie and the LPS radio. It is intended to be used as a tag reporting x/y/z position.
Hubert
Beginner
Posts: 7
Joined: Wed Sep 02, 2020 3:15 pm

Re: LPS Node as Tag and Anchor

Post by Hubert »

Hi Arnaud,

Could you maybe elaborate on how to achieve this:
For TWR (ie. to use a single tag in the system): the node can range with anchors an output ranges on its USB serial port
I would like to get the distances to nodes from a loco node positioned as a TWR tag so that a second (external) mcu (connected over the serial port) can calculate the position. But I can't really find any information on how to configure the node such that it outputs any distance data.


Thank you!
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: LPS Node as Tag and Anchor

Post by arnaud »

Hi Hubert,

The node has an integrated tag mode. It shows up as an USB serial port so if you open the serial port with a terminal and type "t", the node switches in tag mode and starts ranging. You can press "h" to get some help about all the commands available.

If you want to use a real serial port to connect to another MCU, you can compile the firmware by un-commenting the "CFLAGS += -DUSE_FTDI_UART" line. This way the serial menu will be accessible on the FTDI-cable-like header on the node at 115200 baud.
Mathilda
Beginner
Posts: 10
Joined: Thu Jul 30, 2020 10:12 am

Re: LPS Node as Tag and Anchor

Post by Mathilda »

Hi,arnaud,

I want to know how to modify the code in uwb_twr_anchor.c if I want to set LPS node as tag.
I made some changes in uwb_twr_anchor.c.But I am not sure that if it will work as I expected.
https://paste.ubuntu.com/p/7kWZZ3457H/

arnaud wrote: Wed Dec 05, 2018 9:04 am Hi Huzayfaa,

This should be technically feasible, though I can think of a couple of things to look at/think about.

The first one is that you need two tag to work simultaneously in your system. For this you will need either one of the TDoA mode or TWR-TDMA (a TWR mode that uses TDMA timeslots to avoid collision). If you only have 6 anchors and you want to switch one off some time TWR would seem better though TWR-TDMA is not the most tested things now that TDoA2/3 is stable. The problem of TDoA is that you need to be within the anchor convex hull to get good performance, one way could be to add a Z-Ranger to the Crazyflie which allows to get good performance as long as you are in the horizontal convex hull (Z is estimated from the z-ranger and X/Y from the LPS), the Crazyflie EKF should handle that pretty much out of the box.

Then, to switch the anchors in tag mode you need a tag implementation in the nodes. For TWR there is a tag implementation that does not support TDMA (could be ported from Crazyflie easily) and outputs ranges. For TDoA the sniffer mode can be use to implement a tag. The problem is that there is no position estimation implemented in the LPS nodes and so you will need to implement a full tag and the position algorithm for it. To some extent it can be ported from the Crazyflie but the nodes have a much weaker CPU so it should be made carefully (maybe accumulating readings and then estimating position out of them as a batch rather than real time positioning). In that sense the easiest would be to use Crazyflies as Anchor and switching them to tag when they need to move (as a bonus they might even be able to move by themselves ;). Porting the anchor code to the Crazyflie would be much easier and straightforward than porting the tag code to the nodes.

I hope that helps you get going, do not hesitate if you have mode questions. Also please update us of your progress if you can, this is a really interesting concept :).

/Arnaud
Last edited by Mathilda on Wed Oct 07, 2020 8:17 am, edited 1 time in total.
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: LPS Node as Tag and Anchor

Post by arnaud »

Hi Mathilda,

The LPS node already has a TWR tag mode that can be activated from the serial port menu. So what I guess from your code is that you wand an anchor to be able to still act as an anchor but also as a tag at the same time?

You have implemented the part of the code that deals with receiving and reacting to packets, you will also nee something to initiate the ranging procedure: https://github.com/bitcraze/lps-node-fi ... #L212-L234

If you do not need the node to act as a tag and anchor at the same time though, you do not have to change anything, just set the node as tag using the USB serial port.
Mathilda
Beginner
Posts: 10
Joined: Thu Jul 30, 2020 10:12 am

Re: LPS Node as Tag and Anchor

Post by Mathilda »

Hi,Arnaud,
Thank you for your reply! Sorry for not seeing the message until now.
Just as you said, what I want to do is that set a anchor as a tag and anchor at the same time. Because of the ranging procedure launching the whole progress, I copied the function "initiateRanging(dwDevice_t *dev)" in uwb_twr_tag.c, and pasted it into uwb_twr_anchor.c. However, there existed several errors, like this:

Code: Select all

Makefile:83: recipe for target 'bin/lps-node-firmware.elf' failed
src/uwb_twr_tag.o: In function `initiateRanging':
/home/bitcraze/projects/lps-node-firmware//src/uwb_twr_tag.c:222: multiple definition of `initiateRanging'
src/uwb_twr_anchor.o:/home/bitcraze/projects/lps-node-firmware//src/uwb_twr_anchor.c:322: first defined here
collect2: error: ld returned 1 exit status
make: *** [bin/lps-node-firmware.elf] Error 1
Then, I modified the function's name and changed "config" to "configAnchor"(definition:uwbConfig_t configAnchor).
https://paste.ubuntu.com/p/vnrdKV9ZcM/
But there still exist some errors:

Code: Select all

src/uwb_twr_tag.o: In function `initiateRanging':
src/uwb_twr_tag.o: In function `initiateRanging':
/home/bitcraze/projects/lps-node-firmware//src/uwb_twr_tag.c:222: multiple definition of `initiateRanging'
/home/bitcraze/projects/lps-node-firmware//src/uwb_twr_tag.c:222: multiple definition of `initiateRanging'
Makefile:83: recipe for target 'bin/lps-node-firmware.elf' failed
Makefile:83: recipe for target 'bin/lps-node-firmware.elf' failed
src/uwb_twr_anchor.o:/home/bitcraze/projects/lps-node-firmware//src/uwb_twr_anchor.c:322: first defined here
src/uwb_twr_anchor.o:/home/bitcraze/projects/lps-node-firmware//src/uwb_twr_anchor.c:322: first defined here
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
make: *** [bin/lps-node-firmware.elf] Error 1
make: *** [bin/lps-node-firmware.elf] Error 1

02:44:39 Build Failed. 4 errors, 0 warnings. (took 1m:38s.313ms)

But if I delete this function in uwb_tew_anchor.c, no errors will appear. How can I solve this?
Waiting for your reply, Thank you!
Last edited by Mathilda on Thu Oct 29, 2020 1:17 am, edited 4 times in total.
Post Reply