Skip to content
New issue

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

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

Already on GitHub? # to your account

Plot acceleration and jerk #14

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Conversation

davidpilop
Copy link

No description provided.

@volkodava
Copy link

Looks good to me @davidpilop , but I'm unable to run it from my local machine. I've got next stacktrace:

2018-03-11 11:49:55.550724: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed u
p CPU computations.
2018-03-11 11:49:55.550750: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed u
p CPU computations.
2018-03-11 11:49:55.550756: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up C
PU computations.
(6456) accepted ('127.0.0.1', 59772)
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1540, in __call__
    return self.func(*args)
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 590, in callit
    func(*args)
  File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 373, in idle_draw
    self.draw()
  File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 354, in draw
    FigureCanvasAgg.draw(self)
  File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_agg.py", line 474, in draw
    self.figure.draw(self.renderer)
  File "/usr/lib/python2.7/dist-packages/matplotlib/artist.py", line 61, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/matplotlib/figure.py", line 1159, in draw
    func(*args)
  File "/usr/lib/python2.7/dist-packages/matplotlib/artist.py", line 61, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/matplotlib/axes/_base.py", line 2324, in draw
    a.draw(renderer)
  File "/usr/lib/python2.7/dist-packages/matplotlib/artist.py", line 61, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/matplotlib/lines.py", line 712, in draw
    self.recache()
  File "/usr/lib/python2.7/dist-packages/matplotlib/lines.py", line 632, in recache
    raise RuntimeError('xdata and ydata must be the same length')
RuntimeError: xdata and ydata must be the same length
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1540, in __call__
    return self.func(*args)
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 590, in callit
    func(*args)
  File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 373, in idle_draw
    self.draw()
  File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 354, in draw
    FigureCanvasAgg.draw(self)
  File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_agg.py", line 474, in draw

Seems like you have something similar to this: https://stackoverflow.com/a/38445459/1274904

Did you try to run it on your laptop?

My setup:

@subhash
Copy link
Owner

subhash commented Mar 12, 2018

@davidpilop The plot works for me. It pops up right from the beginning and keeps updating as the velocity changes.

But there's an issue. The system is slowed down and the car moves with an extremely slow velocity (<2 mph). When I comment out plt.show(block=True), this error is rectified but obviously, the plot is a blank. I suspect blocking the UI thread does not allow the other parts of the system to function.

Though a live plot looks very cool, a simpler solution would be just to accumulate 2000-3000 sample velocities, acc etc and just popping them up as one plot

@davidpilop davidpilop closed this Mar 12, 2018
@davidpilop davidpilop reopened this Mar 12, 2018
self.acceleration_plot.append((self.velocity_plot[i] - self.velocity_plot[i-1])/diff_time)
self.jerk_plot.append((self.acceleration_plot[i] - self.acceleration_plot[i-1])/diff_time)

if i % 2000 == 0:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidpilop Yep looks good to me, but If I am correct when @subhash suggested

Though a live plot looks very cool, a simpler solution would be just to accumulate 2000-3000 sample velocities, acc etc and just popping them up as one plot

he meant that once you handled 2000-3000 calls (up to you, in your case you decided to go with 2000 seems like) you should just execute the logic within this if condition statement and exit. So in here instead of checking for every 2000 calls with if i % 2000 == 0:, you should probably check for the first 2000 calls only, so you should replace if i % 2000 == 0: to if i == 2000: and also after you show statistics in line 160 (https://github.com/subhash/CarND-Capstone/pull/14/files#diff-7fdad75c966f68bdd51946534578bb1fR160) with plt.show() call you should exit by executing next instructionexit(0).

@subhash could you have a look?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@volkodava @davidpilop The condition is fine for now, we can always quit ROS altogether once we get the plot.

Good job on getting the plot, but something is not right about the values.
see

We cannot be introducing acc or jerk at this level! Can you investigate. Otherwise, I can look at it tomorrow

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think something of this sort is required:

        if i>0:
            self.acceleration_plot.append((self.velocity_plot[i] - self.velocity_plot[i-1])/diff_time)
        if i>1:
            self.jerk_plot.append((self.acceleration_plot[i-1] - self.acceleration_plot[i-2])/diff_time)

Still, we are not great on the jerk front ..

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see

The main part of the run

Copy link

@volkodava volkodava Mar 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@subhash
Copy link
Owner

subhash commented Mar 15, 2018

@davidpilop I think this looks good. The problem is that this PR includes other unrelated commits already in the repo. Could you rebase on top of current master (or start from the current master and just apply your change) and resubmit the PR with only the plot code?

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

Successfully merging this pull request may close these issues.

3 participants