Formula Student Autonomous Systems
The code for the main driverless system
Loading...
Searching...
No Matches
scenario_generator.PointTracker Class Reference
Collaboration diagram for scenario_generator.PointTracker:
Collaboration graph

Public Member Functions

 __init__ (self)
 
 configure_plot (self)
 
 setup_events (self)
 
 on_key (self, event)
 
 set_cone_mode (self, color)
 
 reset_initial_position (self)
 
 set_target_mode (self)
 
 start_final_box (self)
 
 undo_last_cone (self)
 
 remove_marker (self, marker_name)
 
 on_click (self, event)
 
 handle_left_click (self, event)
 
 handle_right_click (self)
 
 add_cone (self, event)
 
 set_initial_position (self, event)
 
 set_target (self, event)
 
 add_final_box_point (self, event)
 
 draw_final_box (self)
 
 calculate_theta (self, p1, p2)
 
 save_points (self)
 

Public Attributes

 fig
 
 ax
 
 x_points
 
 y_points
 
 colors
 
 current_color
 
 scatter
 
 init_pos
 
 temp_target
 
 init_scatter
 
 target_scatter
 
 orientation_line
 
 theta
 
 final_box_points
 
 final_box_plot
 
 mode
 
 on_click
 
 on_key
 

Detailed Description

A class to interactively track and mark points on a matplotlib plot.

The tool supports:
  - Marking yellow and blue cones (track positions).
  - Setting an initial position.
  - Defining a target for orientation.
  - Selecting two points for a final rectangular box.

Data is saved to a file when the user finishes.

Definition at line 6 of file scenario_generator.py.

Constructor & Destructor Documentation

◆ __init__()

scenario_generator.PointTracker.__init__ (   self)

Definition at line 19 of file scenario_generator.py.

Member Function Documentation

◆ add_cone()

scenario_generator.PointTracker.add_cone (   self,
  event 
)
Add a cone point and update the scatter plot.

Definition at line 178 of file scenario_generator.py.

Here is the caller graph for this function:

◆ add_final_box_point()

scenario_generator.PointTracker.add_final_box_point (   self,
  event 
)
Collect final box points and draw the rectangle if two points are set.

Definition at line 230 of file scenario_generator.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ calculate_theta()

scenario_generator.PointTracker.calculate_theta (   self,
  p1,
  p2 
)
Calculate the angle (in radians) between two points relative to the horizontal axis.

Definition at line 255 of file scenario_generator.py.

Here is the caller graph for this function:

◆ configure_plot()

scenario_generator.PointTracker.configure_plot (   self)
Configure the matplotlib plot with title, labels, gridlines, and limits.

Definition at line 51 of file scenario_generator.py.

◆ draw_final_box()

scenario_generator.PointTracker.draw_final_box (   self)
Draw the rectangle representing the final box.

Definition at line 236 of file scenario_generator.py.

Here is the caller graph for this function:

◆ handle_left_click()

scenario_generator.PointTracker.handle_left_click (   self,
  event 
)
Process a left-click event depending on the current mode.

Definition at line 161 of file scenario_generator.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_right_click()

scenario_generator.PointTracker.handle_right_click (   self)
On right-click, save data (if any) and close the plot.

Definition at line 172 of file scenario_generator.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_click()

scenario_generator.PointTracker.on_click (   self,
  event 
)
Route mouse click events based on button and current mode.

Definition at line 151 of file scenario_generator.py.

Here is the call graph for this function:

◆ on_key()

scenario_generator.PointTracker.on_key (   self,
  event 
)
Delegate key press actions to helper methods.

Definition at line 74 of file scenario_generator.py.

Here is the call graph for this function:

◆ remove_marker()

scenario_generator.PointTracker.remove_marker (   self,
  marker_name 
)
Remove a marker attribute if it exists.

Definition at line 144 of file scenario_generator.py.

Here is the caller graph for this function:

◆ reset_initial_position()

scenario_generator.PointTracker.reset_initial_position (   self)
Reset the initial position and clear any orientation markers.

Definition at line 98 of file scenario_generator.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_points()

scenario_generator.PointTracker.save_points (   self)
Save the configuration (initial position, orientation, final box, and cones)
to a text file.

Definition at line 263 of file scenario_generator.py.

Here is the caller graph for this function:

◆ set_cone_mode()

scenario_generator.PointTracker.set_cone_mode (   self,
  color 
)
Set mode for adding cones of a given color.

Definition at line 91 of file scenario_generator.py.

Here is the caller graph for this function:

◆ set_initial_position()

scenario_generator.PointTracker.set_initial_position (   self,
  event 
)
Set the initial position and mark it on the plot.

Definition at line 194 of file scenario_generator.py.

Here is the caller graph for this function:

◆ set_target()

scenario_generator.PointTracker.set_target (   self,
  event 
)
Set the target point, compute orientation, and update markers.

Definition at line 209 of file scenario_generator.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_target_mode()

scenario_generator.PointTracker.set_target_mode (   self)
Prepare to select a target point for orientation.

Definition at line 108 of file scenario_generator.py.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setup_events()

scenario_generator.PointTracker.setup_events (   self)
Connect mouse and key events to their handlers.

Definition at line 69 of file scenario_generator.py.

◆ start_final_box()

scenario_generator.PointTracker.start_final_box (   self)
Initialize final box mode and clear any previous box.

Definition at line 116 of file scenario_generator.py.

Here is the caller graph for this function:

◆ undo_last_cone()

scenario_generator.PointTracker.undo_last_cone (   self)
Remove the last added cone point and update the display.

Definition at line 125 of file scenario_generator.py.

Here is the caller graph for this function:

Member Data Documentation

◆ ax

scenario_generator.PointTracker.ax

Definition at line 21 of file scenario_generator.py.

◆ colors

scenario_generator.PointTracker.colors

Definition at line 26 of file scenario_generator.py.

◆ current_color

scenario_generator.PointTracker.current_color

Definition at line 27 of file scenario_generator.py.

◆ fig

scenario_generator.PointTracker.fig

Definition at line 21 of file scenario_generator.py.

◆ final_box_plot

scenario_generator.PointTracker.final_box_plot

Definition at line 40 of file scenario_generator.py.

◆ final_box_points

scenario_generator.PointTracker.final_box_points

Definition at line 39 of file scenario_generator.py.

◆ init_pos

scenario_generator.PointTracker.init_pos

Definition at line 31 of file scenario_generator.py.

◆ init_scatter

scenario_generator.PointTracker.init_scatter

Definition at line 33 of file scenario_generator.py.

◆ mode

scenario_generator.PointTracker.mode

Definition at line 48 of file scenario_generator.py.

◆ on_click

scenario_generator.PointTracker.on_click

Definition at line 71 of file scenario_generator.py.

◆ on_key

scenario_generator.PointTracker.on_key

Definition at line 72 of file scenario_generator.py.

◆ orientation_line

scenario_generator.PointTracker.orientation_line

Definition at line 35 of file scenario_generator.py.

◆ scatter

scenario_generator.PointTracker.scatter

Definition at line 28 of file scenario_generator.py.

◆ target_scatter

scenario_generator.PointTracker.target_scatter

Definition at line 34 of file scenario_generator.py.

◆ temp_target

scenario_generator.PointTracker.temp_target

Definition at line 32 of file scenario_generator.py.

◆ theta

scenario_generator.PointTracker.theta

Definition at line 36 of file scenario_generator.py.

◆ x_points

scenario_generator.PointTracker.x_points

Definition at line 24 of file scenario_generator.py.

◆ y_points

scenario_generator.PointTracker.y_points

Definition at line 25 of file scenario_generator.py.


The documentation for this class was generated from the following file: