ufo-kit / uca-phantom Goto Github PK
View Code? Open in Web Editor NEWThis project forked from the16thpythonist/uca-phantom
A libuca plugin for the phantom high speed cameras
This project forked from the16thpythonist/uca-phantom
A libuca plugin for the phantom high speed cameras
Glib mainly supports mainly the following: log, message, info, warning, error, debug.
It would be good to able to specify watch messages you wish to display accorrding to what you need.
Libpcap offers zero-copy data transfering for raw sockets (Shared memory between kernel space and user space). This is what is currently done in the driver, but it's messy and prone to errors for in the future.
Using libpcap would clean up the code and make it nore versatile while also maintaining performances (+ it's cross platform! ).
Only downside is that it adds a dependency to download...
Currently the frame rate is not settable. frames-per-second parameter reports 1/exposure-time (defined in uca base camera).
Reading the timestamps is done the same way like the frames.
Possible implementations are:
These are some Glib macros that tell the compiler to automatically free any Heap variable before a return statement.
With this, you no longer need to call g_free() or g_object_unref().
Only caveat : You need to use GCC or CLANG (and also all your variables have to initialized before hand, but this is only natural). Maybe a deal breaker ?
Really not urgent, could simply make the codebase more modern, memory safe and readable.
Not much is actually needed to be done. The task would mostly entail
important: check if updating uca-phantom to modern GObject will break compatibility with uca-camera. => I am reasonable certain that this is not an issue, but this should be sandbox-tested first.
Error management is already solid. But it would be nice to have a nested printing mechanism where each layer of the propagated errors was preceded by a newline+tab when printed.
Implement a seperate class/namespace that manages the phantom purely from a network POV. Use it to seperate the pure network functions from the overrided class functions of uca-phantom.c
.
Doxygen seems to more be widespread and have a better documetation. This could help us easily exhibit our public functions that should be used by the user and how they relate to the super class (which functions are overrided, which member variables are public, etc).
May also enable automatic UML style class-inheritance diagrams.
Classes and their methods would need to have a commented header documenting the said-functions. A standard syntax would have to followed. Fortunately, this is already mostly done.
Behaviour is undefined when doing the following:
GError *error = NULL;
GValue val = G_VALUE_INIT;
gboolean result = FALSE;
UcaPhantomCommunicate *communicator = uca_phantom_communicate_new();
gboolean connected = uca_phantom_communicate_attempt_connect(communicator, &error);
if (!connected) {
g_print ("Houston theres a problem: %s\n", error->message);
g_error_free (error);
g_object_unref (communicator);
return FALSE;
}
struct timespec req, rem;
req.tv_sec = 0;
req.tv_nsec = 5e+6;
for (int i=0; i < N_UNIT_PROPERTIES; i++) {
result = uca_phantom_get_variable (communicator, i, &val, &error);
if (!result && error != NULL) {
g_print ("Houston we've got a problem: %s\n", error->message);
g_error_free (error);
g_object_unref (communicator);
return FALSE;
}
print_gvalue (i, &val);
g_value_unset (&val);
// nanosleep(&req, &rem);
}
g_object_unref (communicator);
Indeed, after a certain and seemingly random amount of requests, the program feezes. However, by adding a blocking sleep command at the end of the loop, all requests are made and all answers are received.
[...]
==45048== Process terminating with default action of signal 2 (SIGINT)
==45048== at 0x4D01D7F: poll (poll.c:29)
==45048== by 0x4AB12AD: g_socket_condition_timed_wait (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.7200.4)
==45048== by 0x4AB161E: ??? (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.7200.4)
==45048== by 0x4A8F1F6: g_input_stream_read (in /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0.7200.4)
==45048== by 0x10CDF9: uca_phantom_communicate (uca-phantom-communicate.c:517)
==45048== by 0x10CDF9: uca_phantom_get_variable (uca-phantom-communicate.c:670)
==45048== by 0x10B9B4: main (test_network.c:51)
==45048==
==45048== HEAP SUMMARY:
==45048== in use at exit: 278,549 bytes in 2,329 blocks
==45048== total heap usage: 11,650 allocs, 9,321 frees, 9,845,914 bytes allocated
==45048==
==45048== LEAK SUMMARY:
==45048== definitely lost: 14 bytes in 1 blocks
==45048== indirectly lost: 0 bytes in 0 blocks
==45048== possibly lost: 3,216 bytes in 4 blocks
==45048== still reachable: 250,999 bytes in 2,089 blocks
==45048== suppressed: 0 bytes in 0 blocks
==45048== Rerun with --leak-check=full to see details of leaked memory
==45048==
==45048== For lists of detected and suppressed errors, rerun with: -s
==45048== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
The memory leak is likely due to the communicator object not being freed after the ctl+c
signal.
TODO
Unit Structure
members as per the PH16 spec sheetSee spec sheet for description of each member variable. More variables are listed out than needed. Before implementing these unit tests, one must first verify which variables need to be known for the general functionning of uca-phantom
, which need to have a default value set and which are prone to be modified.
Nothing important to check
Contains global user-alterable settings that aren’t tied to a particular cine.
acqmode
)partition
)iload
)This section is probably quite important as it is directly related to the network settings of the camera.
definitely not concerned by this
Structure containing the status of the camera timebase and range data acquisition unit. updated ~1Hz.
Variables that control the camera image capture process.
See spec sheet for flag vals
Array of cine structures -> used to store images and meta data (e.g timestamps). More todo in understanding how these structures are layed out in memory.
defc
These copies are done at the time the cine recording ends, and reflects the meta values.
in place at the time of recording.
Probably not important
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.