All camera code has been moved into the operation\subsystems\camera folder
Camera.c contains the main functions to use from scheduler tasks
ADCS.c and Image.c contain internal functions to communicate with the CubeSense MCU
CameraCommon.c contains internal utility functions common to above-mentioned files
Comments have been left in RAdcsCaptureTask.c and RImageCaptureTask.c summarizing the description that follows.
[RAdcsCaptureTask.c] To get detection results and trigger a new detection:
Initialize an empty instance of detection_results_t with detection_results_t data = {0} to hold the detection results.
Call getResultsAndTriggerNewDetection(&data), which will fetch the detection status from CubeSense and calculate the resulting direction vector if detection was successful. See CubeSense's User Manual for more details.
Note 1: Depending on the frequency of the required detection results, it may be desired to change the internal logic of the function or separate the capture and detection functionalities into distinct functions.
[RImageCaptureTask.c] To capture and download an image:
First, an image buffer is needed to allocate memory. Call full_image_t *image = initializeNewImage(<image_size>), where <image_size> is an integer between 0 and 4 (see CubeSense's ICD for more details). The function returns a pointer to the allocated memory for the image.
To tell CubeSense to take a picture, then call captureImage(<camera>, <SRAM>, <location>), where:
<camera> is either 0 (use Camera 1) or 1 (use Camera 2)
<SRAM> is either 0 (store image in SRAM1) or 1 (store image in SRAM2)
<location> is either 0 (store in Top Halve) or 1 (store in Bottom Halve)
To download the captured image, call downloadImage(<SRAM>, <location>, image), where:
<SRAM> is either 0 (image stored in SRAM1) or 1 (image stored in SRAM2)
<location> is either 0 (get from Top Halve) or 1 (get from Bottom Halve)
image is the pointer to the image buffer initialized in Step 1.
Once the image is no longer needed, it is important to free the allocated memory by calling free(image)
Note 1: As per CubeSense's documentation, simple image capture is recommended to be done on the Bottom Halves of each SRAM to not conflict with the Top Halves used for the detection algorithm.
Note 2: It is suggested to wait a small amount of time (<1 sec) between capturing and downloading an image, to allow enough time for CubeSense to store the captured image in its memory.
Latest camera update:
operation\subsystems\camera
folderCamera.c
contains the main functions to use from scheduler tasksADCS.c
andImage.c
contain internal functions to communicate with the CubeSense MCUCameraCommon.c
contains internal utility functions common to above-mentioned filesRAdcsCaptureTask.c
andRImageCaptureTask.c
summarizing the description that follows.[RAdcsCaptureTask.c] To get detection results and trigger a new detection:
detection_results_t
withdetection_results_t data = {0}
to hold the detection results.getResultsAndTriggerNewDetection(&data)
, which will fetch the detection status from CubeSense and calculate the resulting direction vector if detection was successful. See CubeSense's User Manual for more details.[RImageCaptureTask.c] To capture and download an image:
full_image_t *image = initializeNewImage(<image_size>)
, where<image_size>
is an integer between 0 and 4 (see CubeSense's ICD for more details). The function returns a pointer to the allocated memory for the image.captureImage(<camera>, <SRAM>, <location>)
, where:<camera>
is either 0 (use Camera 1) or 1 (use Camera 2)<SRAM>
is either 0 (store image in SRAM1) or 1 (store image in SRAM2)<location>
is either 0 (store in Top Halve) or 1 (store in Bottom Halve)downloadImage(<SRAM>, <location>, image)
, where:<SRAM>
is either 0 (image stored in SRAM1) or 1 (image stored in SRAM2)<location>
is either 0 (get from Top Halve) or 1 (get from Bottom Halve)image
is the pointer to the image buffer initialized in Step 1.free(image)