Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why is the function to get the nearest distance in MPC controller in the following form? #1

Open
TheDarkKnight1998 opened this issue Jun 9, 2021 · 1 comment

Comments

@TheDarkKnight1998
Copy link

Hello, I'm learning to use your framework, some of which MPC didn't understand

def _get_closest_dist(self, pred, pos_veh_front): #TODO
closest_dist = np.full(len(pred), float('Inf'))#
if pos_veh_front < pred[0][0]: # before the vehicle reach the crossing point
for i in range(len(pred)):
lat_max = pred[i, 1] + pred[i, 2] # sy + vx???
lat_min = pred[i, 1] - pred[i, 2]

            if 0 < lat_min < self.W_lane or 0 < lat_max < self.W_lane or \
                    (0 < lat_min and lat_max < self.W_lane) or (lat_min < 0 and self.W_lane < lat_max):  #
                lon_min = pred[i, 0] - pred[i, 2] #sx -vx ??
                closest_dist[i] = lon_min

    return closest_dist

Can you explain it?

@TheDarkKnight1998
Copy link
Author

Index 2 should be 4, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant