symforce-org / symforce

Fast symbolic computation, code generation, and nonlinear optimization for robotics
https://symforce.org
Apache License 2.0
1.41k stars 145 forks source link

2d robot localization example plotting failing #238

Closed stefangachter closed 1 year ago

stefangachter commented 2 years ago

Describe the bug I built successfully symforce from source. If running the 2d robot localization example (/symforce/examples/robot_2d_localization/robot_2d_localization.py), then I get the following error:

Traceback (most recent call last):
  File "/home/gstef/Programs/Sandbox/symforce/symforce/examples/robot_2d_localization/robot_2d_localization.py", line 191, in <module>
    main()
  File "/home/gstef/Programs/Sandbox/symforce/symforce/examples/robot_2d_localization/robot_2d_localization.py", line 115, in main
    plot_solution(optimizer, result)
  File "/home/gstef/Programs/Sandbox/symforce/symforce/examples/robot_2d_localization/plotting.py", line 149, in plot_solution
    iteration_slider.set_val(len(values_per_iter) - 1)
  File "/home/gstef/.venvs/symforce/lib/python3.10/site-packages/matplotlib/widgets.py", line 568, in set_val
    self._observers.process('changed', val)
  File "/home/gstef/.venvs/symforce/lib/python3.10/site-packages/matplotlib/cbook/__init__.py", line 292, in process
    self.exception_handler(exc)
  File "/home/gstef/.venvs/symforce/lib/python3.10/site-packages/matplotlib/cbook/__init__.py", line 96, in _exception_printer
    raise exc
  File "/home/gstef/.venvs/symforce/lib/python3.10/site-packages/matplotlib/cbook/__init__.py", line 287, in process
    func(*args, **kwargs)
  File "/home/gstef/.venvs/symforce/lib/python3.10/site-packages/matplotlib/widgets.py", line 585, in <lambda>
    return self._observers.connect('changed', lambda val: func(val))
  File "/home/gstef/Programs/Sandbox/symforce/symforce/examples/robot_2d_localization/plotting.py", line 116, in update_plot
    poses_lines[0].set_data(data.pose_xy.T)
  File "/home/gstef/.venvs/symforce/lib/python3.10/site-packages/matplotlib/lines.py", line 639, in set_data
    (x, y), = args
ValueError: not enough values to unpack (expected 2, got 1)

When debugging the script, the data.pose_xy is as follows: image

To Reproduce Steps to reproduce the behavior, e.g.:

  1. Run robot_2d_localization.py

Expected behavior Plot the result as described in the example https://symforce.org/#guides

Environment (please complete the following information):

aaron-skydio commented 1 year ago

Thanks for reporting! Should be fixed by #245