rodrigoqueiroz / geoscenarioserver

9 stars 1 forks source link

Dashboard Pedestrians #77

Closed WAEliasmith closed 3 years ago

WAEliasmith commented 3 years ago

Added pedestrians to dashboard, with Cartesian chart when selected.

Testing:

$ slaunch ring_road_ccw
* no pedestrians or errors on dashboard as expected
$ cdgss
$ source /opt/ros/lanelet2/setup.bash --extend
$ ./GSServer.py -s scenarios/pedestrian_scenarios/gs_intersection_xwalk_signal.osm
*shows pedestrian and Cartesian chart

restart terminal.
$ cdts
checkout ring-road-pedestrian branch from https://github.com/wavelab/anm_unreal_test_suite/pull/97
$ slaunch rr_xwalk_intersection_basic
*can select pedestrian and other vehicles, and see Cartesian chart

Additional testing: change vid 5 to vid 1 in rr_xwalk_intersection_basic: $ slaunch rr_xwalk_intersection_basic gives error: File "/home/ae/anm_unreal_sim/submodules/geoscenarioserver/dash/Dashboard.py", line 162, in update_pedestrian_table self.tab.insert('', 'end', int(pid), values=(sp)) File "/usr/lib/python3.8/tkinter/ttk.py", line 1365, in insert res = self.tk.call(self._w, "insert", parent, index, _tkinter.TclError: Item 1 already exists This bug has been fixed.

Next steps: Putting pedestrians in another table will make the formatting cleaner.

mantkiew commented 3 years ago

Here's my mockup: gss_agent_table_header_repeated

WAEliasmith commented 3 years ago

Here's my mockup: gss_agent_table_header_repeated

Yeah, this looks like what I had in mind too, but it doesn't look possible with one table, since that row uses tkinter's tab['columns']

mchlswyr commented 3 years ago

Code looks ok but I'm getting this error: ...

I got the same error on the same scenario. I think it is because there are two rows in the table named "1": one for vid 1 and one for pid 1. If we want to use the same table, then we'll have to distinguish between vid x and pid x:

# insert "vx" for vid x
self.tab.insert('', 'end', "v" + str(vid), values=(sv))
...
# insert "px" for pid x
self.tab.insert('', 'end', "p" + str(pid), values=(sp))

Even if we want to use two tables, we will have to prepend "v" and "p":

self.vtab.insert('', 'end', "v" + str(vid), values=(sv))
...
self.ptab.insert('', 'end', "p" + str(pid), values=(sp))

Otherwise, if the user focuses on a row with vid 1 in the vehicle table, for example, and there is a row with pid 1 in the pedestrian table, we won't know if a vehicle or a pedestrian is in focus. We will just know that a row with the name "1" has been clicked on.

mantkiew commented 3 years ago

We can keep a single table with a single header on top and use "v" + str(vid) and "p" + str(pid) as Michael suggested. @WAEliasmith would that work?

mchlswyr commented 3 years ago

I still have issues on scenarios/test_scenarios/gs_straight_pedestrian.osm. When I click on the pedestrian it focuses on the vehicle. I think it's because update_table() is always called before update_pedestrian_table().

Also, the table loses focus after clicking a row (the row doesn't stay highlighted). I think we need to keep self.center_id as "vx" or "px", and convert it to an int when we want to focus on the vehicle or pedestrian in the cartesian and frenet plots.

To solve these issues we could add something like this around here:

if self.center_id[0] == 'v':
    vid = int(self.center_id[1:])
    # update cartesian and frenet plot
elif self.center_id[0] == 'p':
    pid = int(self.center_id[1:])
    # update cartesian plot
# else ignore it since they must have focused on the "Pedestrian" header
...
WAEliasmith commented 3 years ago

I still have issues on scenarios/test_scenarios/gs_straight_pedestrian.osm. When I click on the pedestrian it focuses on the vehicle. I think it's because update_table() is always called before update_pedestrian_table().

Also, the table loses focus after clicking a row (the row doesn't stay highlighted). I think we need to keep self.center_id as "vx" or "px", and convert it to an int when we want to focus on the vehicle or pedestrian in the cartesian and frenet plots.

To solve these issues we could add something like this around here:

if self.center_id[0] == 'v':
    vid = int(self.center_id[1:])
    # update cartesian and frenet plot
elif self.center_id[0] == 'p':
    pid = int(self.center_id[1:])
    # update cartesian plot
# else ignore it since they must have focused on the "Pedestrian" header
...

I am looking into it, but the center_id is an int, and the letter is removed in change_tab_focus(), so I will use similar code but with self.tab.focus