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

Crash #1

Open
cavour22710 opened this issue May 31, 2019 · 3 comments
Open

Crash #1

cavour22710 opened this issue May 31, 2019 · 3 comments

Comments

@cavour22710
Copy link

cavour22710 commented May 31, 2019

I've simply dowloaded the code and tried to run it but i don't understand what it should do, as soon as the two images appear and i press w,a,s,d or i,j,k,l the program closes itself with this error:
C:....\2D-Grid-SLAM-master\ParticleFilter.py:130: RuntimeWarning: invalid value encountered in true_divide
self.weights = field / np.sum(field)
Traceback (most recent call last):
File "test.py", line 123, in
pf.Resampling(sensor_data)
File "C:...\2D-Grid-SLAM-master\ParticleFilter.py", line 113, in Resampling
re_id = np.random.choice(self.size, self.size, p=list(self.weights))
File "mtrand.pyx", line 1144, in mtrand.RandomState.choice
ValueError: probabilities contain NaN

@jerrywiston
Copy link
Contributor

Can you describe your environment in detail ?

@horo2016
Copy link

in ParticleFilter.py modify as follow:
if np.sum(field)!= 0:
self.weights = field / np.sum(field)

@DuQingChen
Copy link

DuQingChen commented Mar 9, 2022

ParticleFilter.py , line 113
self.weights[np.isnan(self.weights)] = 1 / len(self.weights)
re_id = np.random.choice(self.size, self.size, p=list(self.weights))

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

4 participants