-
Notifications
You must be signed in to change notification settings - Fork 0
Constants
Omega Core edited this page May 19, 2024
·
7 revisions
A storage-related file, 'constants.py' packs all of the interface variables into a single class. We do this because of Python's property of pointer parameters. Passing around a single 'constants' object doesn't create a different instance, it actually gives the memory adress
to the consignee. So, by spreading the same constants object from our core file, all other parts of the simulator can change constant values, changes visible for every other file, as they share the same memory. That's why we have a complex ecosystem of classes in our program.
It is also used to load all the images making up the actual interface menu, scale them and all that sweet stuff.
-
pixels_to_dec
= how many pixels are in 1 decimeter ; -
fps
= frames per second the simulator runs at ; -
robot_img_source
= the path (starting from the C: directory) of the desired robot image ; -
robot_scale
= NOT A PERCENT, the actual scaling value for the robot image ; -
robot_width
= robot image width, in cm ; -
robot_height
= robot image height, actual robot length, in cm ; -
text_color
= the color of text surfaces, like the 'X' and 'Y' from the coordinate system. Takes in a string with the color name or a tuple with rgb values ; -
text_font
= desired font shown (the menu font remains 'graffitiyouthregular' because those are images) for the coordinate system and robot position. Takes in a string with the name of the font, in lower case, letters united ; -
max_trail_len
= the maximum length of points a trail can contain ; -
max_trail_segment_len
= the maximum length a points a trail segment can contain ; -
draw_trail_threshold
= the distance (in pixels) between two points in the same trail segment ; -
trail_color
= the general color of a trail. Same input astext_color
; -
trail_loops
= how many code loops can you stay in one place without the trail starting to disappear ; -
trail_width
= the width (in pixels) of the lines making up the trail ; -
background_color
= the color of the background ; -
axis_color
= the color of the coordinate system axis ; -
grid_color
= the color of the coordinate system grid ; -
width_percent
= percent of window screen used to scale display of user joystick pressed (like showing / hiding the trail) ; -
backing_distance
= the distance (in cm) the robot backs up from outside the border in one loop ; -
arrow_offset
= the offset in X and Y directions, in pixels, of the bottom of the coordinate system arrow ; -
half_unit_measure_line
= the unit measure displayed by the grid on the screen ; -
time_until_fade
= time for a surface to keep it's opacity at 100% before fading, in sec ; -
fade_percent
= the percent opacity decreases each loop ; -
screen_size
= width and height of the display window ;
-
COEFF_JOY_HEAD
= pid coefficients for the controller used in the field centric mode ; -
DRAW_ROBOT_BORDER
= boolean on drawing a rectangle where the robot image margins are ; -
FIELD_CENTRIC
= boolean on field centric driving mode ; -
USE_SCREEN_BORDER
= boolean for enabling the robot to exit the simulator window ; -
MENU_ENTERED
= boolean for entering the interface menu ; -
HEAD_SELECTION
= boolean for entering the heading selection option ; -
FORWARDS
= boolean used only for field centric drive, specifying the direction of movement; -
ERASE_TRAIL
= when set to True, it erases all the segments with all the points inside the trail ; -
JOYSTICK_ENABLED
= boolean used to know if any joystick is connected ; -
FREEZE_TRAIL
= when set to True, no more updates on the trail component is done ; -
DRAW_TABLE
= when set to True, enters the field mode ;