-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
176 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,6 @@ | |
.devcontainer/ | ||
/build/ | ||
/images/ | ||
/venv/ | ||
/venv/ | ||
/external/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,5 +57,5 @@ pip install -r requirements.txt | |
``` | ||
|
||
## Authors | ||
|
||
* **Richard Han** - [@rrhan0](https://github.com/rrhan0) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
|
||
//constructor | ||
AravisCamera::AravisCamera(){ | ||
std::cout<<"connecting to camera\n"; | ||
// checking for cameras | ||
arvcamera = arv_camera_new(NULL, &error); | ||
if (ARV_IS_CAMERA(arvCamera) == 0){ | ||
throw std::runtime_error("No camera connected"); | ||
//error if no cameras found | ||
} | ||
set_default(); | ||
//set_epoch(); | ||
// apparently this is unecessary because we can get timestamp for each buffer | ||
} | ||
|
||
//destructor | ||
AravisCamera::~AravisCamera(){ | ||
std::cout<<"Cleaning up\n"; | ||
g_clear_object (&arvCamera); | ||
} | ||
|
||
//setting pixel format | ||
void set_pixelformat(const std::string &pixelformat){ | ||
const char* cstr = pixelformat.c_str(); | ||
arv_camera_set_pixel_format_from_string (arvCamera,cstr,error); | ||
} | ||
|
||
//setting exposure time | ||
void set_exposuretime(float exposuretime){ | ||
arv_camera_set_exposure_time(arvCamera, exposuretime, error); | ||
} | ||
|
||
//setting gain | ||
void set_gain(float gain) { | ||
std::cout << "Setting gain to " << gain << "\n"; | ||
arv_camera_set_gain(arvCamera, gain, error); | ||
} | ||
|
||
// start stream | ||
// ? Not sure about number of buffers | ||
|
||
void start_stream (){ | ||
std::cout << "Starting stream\n"; | ||
stream = arv_camera_create_stream(arvCamera, NULL, NULL, error); | ||
if (stream == NULL){ | ||
throw std::runtime_error("No stream"); | ||
} | ||
arv_camera_start_acquisition(arvCamera, error); | ||
} | ||
|
||
|
||
//end acquisition and exit stream | ||
|
||
|
||
void stop_steam(){ | ||
std::cout << "stopping stream\n"; | ||
arv_camera_stop_acquisiton(arvCamera,error); | ||
g_clear_object (&stream); | ||
g_clear_object (&arvBuffer); | ||
} | ||
|
||
|
||
//getting an image | ||
void get_image (){ | ||
arvBuffer = arv_camera_acquisition(arvCamera, 0, error); | ||
if (arvBuffer != NULL){ | ||
//double width = arv_buffer_get_image_width(buffer); | ||
timeStamp = arv_buffer_get_timestamp(arvBuffer); // not sure if this one is better than the next line | ||
timeStamp = arv_buffer_get_system_timestamp(arvBuffer); | ||
} | ||
|
||
//store buffer to file commands here..? | ||
//store timestamp as well? | ||
g_clear_object (&arvBuffer); | ||
g_clear_object(&timeStamp); | ||
} | ||
|
||
void set_epoch(){ | ||
|
||
//is this still necessary if we can find timestamp of buffer? | ||
} | ||
|
||
//setting default values to camera | ||
void set_default(){ | ||
|
||
//const char* string is the name of the node based on GenIcam standard naming | ||
arv_gc_set_default_node_data (genicam, "ExposureTime"); | ||
arv_gc_set_default_node_data (genicam, "PixelFormat"); | ||
arv_gc_set_default_node_data (genicam, "Gain"); | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#ifndef SRC_ARAVISCAMERA_HPP_ | ||
#define SRC_ARAVISCAMERA_HPP_ | ||
|
||
//#include "ArenaApi.h" | ||
#include "ICamera.hpp" | ||
|
||
class AravisCamera : public ICamera { | ||
private: | ||
int64_t timeStamp; /**< Epoch time for timestamping. */ | ||
//need to find member variables | ||
ArvCamera* arvCamera; | ||
GError *error = NULL; | ||
ArvSteam *stream; | ||
ArvBuffer *arvBuffer; | ||
ArvGc *genicam; | ||
// bool _trigger_state = false; /**< Trigger state flag. */ | ||
public: | ||
AravisCamera(); // Constructor | ||
~AravisCamera(); // Destructor | ||
/** | ||
* @brief Sets the pixel format for the camera. | ||
* @param pixelformat A string specifying the pixel format. | ||
*/ | ||
|
||
void set_pixelformat(const std::string &pixelformat); | ||
/** | ||
* @brief Turns off auto expsure and sets the exposure time for the camera. | ||
* @param exposuretime A float of range [359.328, 151839.528] specifying the | ||
* exposure time in microseconds. | ||
*/ | ||
void set_exposuretime(float exposuretime); | ||
|
||
/** | ||
* @brief Sets the gain for the camera. | ||
* @param gain A float of range [0.0, 27.045771199653988] specifying the gain | ||
* value. Default gain in 0.0 | ||
*/ | ||
void set_gain(float gain); | ||
|
||
// /** | ||
// * @brief Enables or disables the manual trigger mode for the camera. | ||
// * @param trigger_on A boolean where true enables and false disables it. | ||
// */ | ||
// void set_trigger(bool trigger_on); | ||
|
||
/** | ||
* @brief Starts the image stream from the camera. | ||
* @param num_buffers An integer specifying the number of buffers to use. | ||
* Default is 10. | ||
* Not sure about the parameters... | ||
*/ | ||
void start_stream(); | ||
|
||
/** | ||
* @brief Stops the image stream from the camera. | ||
*/ | ||
void stop_stream(); | ||
|
||
/** | ||
* @brief Retrieves an image from the camera. | ||
* @param timestamp A pointer to a 64-bit integer to store the image | ||
* timestamp. | ||
* @return A boolean indicating success (true) or failure (false). | ||
*/ | ||
std::unique_ptr<ImageData> get_image(); | ||
|
||
private: | ||
/** | ||
* @brief Sets default configurations for the camera. | ||
*/ | ||
void set_default(); | ||
|
||
/** | ||
* @brief Sets the epoch time. | ||
* Is this still necessary if we can get the timestamp for an image? | ||
*/ | ||
void set_epoch(); | ||
}; | ||
|
||
#endif // SRC_ARENACAMERA_HPP_ |