Scan
- class opencsp.common.lib.uas.Scan.Scan(scan_passes)
Bases:
objectA flight scan, comprised of a sequence of scan passes.
- __init__(scan_passes)
A flight scan, comprised of a sequence of scan passes.
- Parameters:
scan_passes (list of ScanPass) – A list of ScanPass objects representing the individual scan passes that make up the flight scan.
- draw(view, scan_pass_styles)
Render the scan passes on the specified view using the provided styles.
- Parameters:
view (object) – The view object where the scan passes will be rendered.
scan_pass_styles (dict) – A dictionary containing styles for rendering the scan passes.
- Return type:
None
- locale()
Get the locale of the first scan pass.
- Returns:
The locale of the first scan pass in the sequence.
- Return type:
str
- set_scan_pass_numbers(next_scan_index)
Set the index for each scan pass and return the next available index.
- Parameters:
next_scan_index (int) – The starting index to assign to the scan passes.
- Returns:
The next available index after assigning numbers to the scan passes.
- Return type:
int
- waypoints()
Retrieve a list of waypoints from all scan passes.
- Returns:
A list of waypoints collected from each scan pass.
- Return type:
list
- opencsp.common.lib.uas.Scan.construct_scan_given_UFACET_scan_passes(ufacet_scan_pass_list, scan_parameters)
Construct a Scan object given a list of UFACET scan passes.
This function creates scan passes based on the provided UFACET scan passes and scan parameters, arranging them in a back-and-forth boustrophedon pattern.
- Parameters:
ufacet_scan_pass_list (list of ScanPass) – A list of UFACET scan passes to be used for constructing the Scan object.
scan_parameters (dict) – A dictionary containing parameters for the scan configuration.
- Returns:
A Scan object constructed from the provided UFACET scan passes and parameters.
- Return type:
Notes
The function assumes that UFACET scans are specified by line segments that are parallel, and it reverses every other pass to create a boustrophedon pattern.
Examples
>>> scan = construct_scan_given_UFACET_scan_passes(ufacet_passes, {'fly_forward_backward': True})
- opencsp.common.lib.uas.Scan.construct_scan_given_segments_of_interest(list_of_xyz_segments, scan_parameters)
Construct a Scan object given a list of XYZ segments of interest.
This function creates scan passes based on the provided segments and scan parameters, arranging them in a back-and-forth boustrophedon pattern.
- Parameters:
list_of_xyz_segments (list of list of float) – A list of segments, where each segment is defined by a list of XYZ coordinates.
scan_parameters (dict) – A dictionary containing parameters for the scan configuration.
- Returns:
A Scan object constructed from the provided segments and parameters.
- Return type:
Notes
The function assumes that the input segment list is parallel, meaning each segment points from p0 to p1 in the same direction. It reverses every other segment to create a boustrophedon pattern.
Examples
>>> scan = construct_scan_given_segments_of_interest([[0, 0, 0], [1, 1, 1]], {'fly_forward_backward': True})
ScanPass
- class opencsp.common.lib.uas.ScanPass.ScanPass
Bases:
objectModel a scan pass within a flight.
This class represents a single scan pass, which consists of waypoints and associated parameters for a flight operation.
- idx
The index of the scan pass.
- Type:
int
- __init__()
Model a scan pass within a flight.
This class represents a single scan pass, which consists of waypoints and associated parameters for a flight operation.
- core_waypoints()
Retrieve the core waypoints for the scan pass.
- Returns:
A list of core waypoints for the scan pass.
- Return type:
list
- Raises:
AssertionError – If the core waypoint list is not set.
- draw(view, scan_pass_styles)
Render the scan pass on the specified view using the provided styles.
- Parameters:
view (object) – The view object where the scan pass will be rendered.
scan_pass_styles (object) – An object containing styles for rendering the scan pass.
- Return type:
None
- lead_in()
Retrieve the lead-in distance for the scan pass.
- Returns:
The lead-in distance for the scan pass.
- Return type:
float
- Raises:
AssertionError – If the lead-in distance is not set.
- locale()
Retrieve the locale for the scan pass.
- Returns:
The locale for the scan pass.
- Return type:
str
- Raises:
AssertionError – If the locale is not set.
- run_past()
Retrieve the run-past distance for the scan pass.
- Returns:
The run-past distance for the scan pass.
- Return type:
float
- Raises:
AssertionError – If the run-past distance is not set.
- segment_dict()
Retrieve the segment dictionary for the scan pass.
- Returns:
The segment dictionary for the scan pass.
- Return type:
dict
- Raises:
AssertionError – If the segment dictionary is not set.
- set_core_waypoints_from_UFACET_scan_pass(ufacet_scan_pass)
Set the core waypoints from a UFACET scan pass.
- Parameters:
ufacet_scan_pass (UfacetScanPass) – The UFACET scan pass from which to set the core waypoints.
- Return type:
None
- set_core_waypoints_given_segment_of_interest(segment_xyz, fly_backward, raster_scan_parameters)
Set the core waypoints based on a segment of interest.
- Parameters:
segment_xyz (list of list of float) – A list of XYZ coordinates defining the segment of interest.
fly_backward (bool) – A flag indicating whether to fly backward along the segment.
raster_scan_parameters (dict) – A dictionary containing parameters for the raster scan.
- Return type:
None
- Raises:
AssertionError – If the gaze angle is positive.
- set_waypoints_with_margin(scan_parameters)
Set waypoints with lead-in and run-past margins.
- Parameters:
scan_parameters (dict) – A dictionary containing parameters for the scan, including lead-in and run-past distances.
- Return type:
None
- Raises:
AssertionError – If the core waypoint list is not set or has fewer than two elements.
- ufacet_scan_pass()
Retrieve the associated UFACET scan pass.
- Returns:
The associated UFACET scan pass.
- Return type:
UfacetScanPass
- Raises:
AssertionError – If the UFACET scan pass is not set.
- waypoints()
Retrieve all waypoints for the scan pass.
- Returns:
A list of all waypoints for the scan pass.
- Return type:
list
- Raises:
AssertionError – If the waypoint list is not set.
- opencsp.common.lib.uas.ScanPass.construct_scan_pass_given_UFACET_scan_pass(ufacet_scan_pass, fly_backward, scan_parameters)
Construct a ScanPass object given a UFACET scan pass.
- Parameters:
ufacet_scan_pass (UfacetScanPass) – The UFACET scan pass from which to construct the ScanPass.
fly_backward (bool) – A flag indicating whether to fly backward for this scan pass.
scan_parameters (dict) – A dictionary containing parameters for the scan configuration.
- Returns:
A ScanPass object constructed from the provided UFACET scan pass and parameters.
- Return type:
Examples
>>> scan_pass = construct_scan_pass_given_UFACET_scan_pass(ufacet_pass, True, {'locale': 'en'})
- opencsp.common.lib.uas.ScanPass.construct_scan_pass_given_segment_of_interest(segment_xyz, fly_backward, scan_parameters)
Construct a ScanPass object given a segment of interest.
- Parameters:
segment_xyz (list of list of float) – A list of XYZ coordinates defining the segment of interest.
fly_backward (bool) – A flag indicating whether to fly backward along the segment.
scan_parameters (dict) – A dictionary containing parameters for the scan configuration.
- Returns:
A ScanPass object constructed from the provided segment and parameters.
- Return type:
Examples
>>> scan_pass = construct_scan_pass_given_segment_of_interest([[0, 0, 0], [1, 1, 1]], False, {'locale': 'en'})
WayPoint
- class opencsp.common.lib.uas.WayPoint.WayPoint(locale, xyz, theta, eta, stop, speed)
Bases:
objectA waypoint in a flight plan.
This class represents a waypoint defined by its geographic location, heading, gaze angle, and other parameters relevant to a flight operation.
- idx
The index of the waypoint in the flight plan.
- Type:
int
- lon
The longitude of the waypoint, calculated based on the locale.
- Type:
float
- lat
The latitude of the waypoint, calculated based on the locale.
- Type:
float
- __init__(locale, xyz, theta, eta, stop, speed)
A waypoint in a flight plan.
This class represents a waypoint defined by its geographic location, heading, gaze angle, and other parameters relevant to a flight operation.
- Parameters:
locale (str) – Information needed to convert (x, y, z) coordinates into global (longitude, latitude) coordinates.
xyz (list of float) – The (x, y, z) coordinates in the solar field coordinate system, measured in meters.
theta (float) – The heading of the waypoint, measured in radians counterclockwise from the x-axis (East).
eta (float) – The gaze angle of the waypoint, measured in radians counterclockwise from the drone axis pointing forward.
stop (bool) – A flag indicating whether the drone should stop at this waypoint.
speed (float) – The speed to the next waypoint, in meters per second, in the heading direction.
- draw(view, waypoint_styles)
Render the waypoint on the specified view using the provided styles.
- Parameters:
view (object) – The view object where the waypoint will be rendered.
waypoint_styles (object) – An object containing styles for rendering the waypoint.
- Return type:
None
- gaze_ray(length)
Construct a vector representing the gaze direction of the waypoint.
- Parameters:
length (float) – The length of the gaze ray.
- Returns:
A list containing the tail and head coordinates of the gaze ray.
- Return type:
list
Examples
>>> waypoint = WayPoint('NSTTF', [0, 0, 0], 0, np.pi/4, False, 5) >>> waypoint.gaze_ray(1.0) [[0, 0, 0], [0.7071067811865476, 0.7071067811865475, 0.7071067811865475]]
- gimbal_pitch_deg()
Get the gimbal pitch of the waypoint in degrees.
The gimbal pitch is defined as 0 degrees for horizontal and -90 degrees for straight down.
- Returns:
The gimbal pitch of the waypoint in degrees.
- Return type:
float
Examples
>>> waypoint = WayPoint('NSTTF', [0, 0, 0], 0, -np.pi/2, False, 5) >>> waypoint.gimbal_pitch_deg() -90.0
- heading_deg()
Get the heading of the waypoint in degrees clockwise from north.
- Returns:
The heading of the waypoint in degrees.
- Return type:
float
Examples
>>> waypoint = WayPoint('NSTTF', [0, 0, 0], np.pi/4, 0, False, 5) >>> waypoint.heading_deg() 45.0
- heading_ray(scale)
Construct a vector representing the heading direction of the waypoint.
- Parameters:
scale (float) – A scaling factor to determine the length of the heading ray.
- Returns:
A list containing the tail and head coordinates of the heading ray.
- Return type:
list
Examples
>>> waypoint = WayPoint('NSTTF', [0, 0, 0], 0, 0, False, 5) >>> waypoint.heading_ray(1.0) [[0, 0, 0], [1.0, 0.0, 0.0]]
- set_longitude_latitude()
Set the longitude and latitude of the waypoint based on its coordinates and locale.
This method uses the locale attribute to determine how to convert the (x, y) coordinates into longitude and latitude. It raises an assertion error if an unexpected locale is encountered.
- Return type:
None