IQTLabs / BirdsEye

The BirdsEye RL/RF project enables localization of mobile radio frequency targets, e.g., drones operators, via commericial off-the-shelf sensors.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clarity on update_state function

zhampel opened this issue · comments

@goldfrank Can you please provide some clarity on the operations in the update_state function in state.py? We are trying to encode some specific target behavior (linear motion only, rotation at a specified radius), but we are not seeing the proper motion in the visualization of demo.ipynb. For example, why does spd = control[1] on the second code line of this function?

def update_state(self, target_state, control):

Specifically, the spd=control[1] part of the function assigns the sensor speed to the second value of the action tuple. If the actions are:

   0   (-30, 1)
   1   (-30, 2)
   2   (0, 1)
   3   (0, 2)
   4   (30, 1)
   5   (30, 2)

the second value of the tuple is the speed.

the next block:

        theta = theta % 360
        theta -= control[0]
        theta = theta % 360
        if theta < 0:
            theta += 360

        crs = crs % 360
        crs -= control[0]
        if crs < 0:
            crs += 360
        crs = crs % 360

Applies the relative target course change of the "turning" component of the action (control[0]) and also shifts the relative bearing of the target (since the action affects relative bearing as well as course). This is because turning the sensor affects both the relative bearing to the target as well as the relative course of the target.

Illustrative example: the sensor and the target are facing each other:

S--->    <---T

If the sensor turns 90 degrees left, the relative bearing to the target is now 90 degrees offset to the right, but also the target's relative course is offset.

^
|
S      <---T

The rest of the function implements a random walk for target behavior and performs some polar-to-cartesian transformations.

The target motion is defined:

if random.random() >= self.prob:
            crs += random.choice([-1, 1]) * 30
            crs %= 360
            if crs < 0:
                crs += 360

A straightforward way to implement some other target behavior would be to call a function that defines target motion. I tried to push a branch that implements this, but I don't know if I can because of my status as a collaborator.

As for the displayed behavior, it seems there are some issues with how the "absolute" plotting behavior works-- I don't think it's accounting for cumulative motion of the sensor, so I should ask what the "absolute" refers to. Perhaps we should get on a call today to discuss? I'm free before 7 PM EDT.

@goldfrank Thanks for the detailed response. Let's wait for @ltindall to take a look, he also mentioned having made some progress on this late last night. The best time for me would be 3-4pm EDT.