-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates for v0.9.2 #142
Updates for v0.9.2 #142
Conversation
|
||
# Calculate the total time as seconds plus fractional seconds from nanoseconds and attoseconds | ||
total_time = ssec + (nsec * 1e-9) | ||
base_time = datetime(1970, 1, 1) + timedelta(seconds=ssec, microseconds=nsec / 1_000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new approach is library-based. The original code was written as non-Pythonic, non library-based, and as simple as possible, in order to facilitate porting to other less-capable embedded languages like C. Making the code more Pythonic and library-based makes the code less easy to port. But if you don't think that is a priority, I can live with it this way. My primary goal in writing the parser was to have /something/ in place for the first public release and big announcement at MTS.
return base_time.strftime(f"%Y-%jT%H:%M:%S.{nsec}") | ||
else: | ||
# Return individual components based on 'part' argument | ||
parts_map = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, this is now a Pythonic data struct, not as easy to port to C language. But if you think this is the way to go with examples, I can live with it.
return (1000.0/25.4) | ||
|
||
def get_camera_translation(self, dimension): | ||
"""Return a single axis of camera translation, such as: x,y, or z""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll have to add this string back in, as it was omitted below. (Or the docs won't have anything for this method.)
return tr["translation"]["z"] * self.trans_mult | ||
print("found camera, dim = {}, mult factor: {}".format(dimension.value, self.trans_mult)) | ||
if (dimension == Translation.X): | ||
return tr["translation"][Translation.X.value] * self.trans_mult.conversion_factor_from_meters() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
break | ||
return None | ||
|
||
def get_camera_rotation(self, dimension): | ||
"""Return a single axis of camera rotation like pan, tilt, or roll. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the documentation string back in, it got omitted below.
if self.validate_dict_elements(self.pd,["timing","sampleRate","num"]): | ||
numerator = float(self.pd["timing"]["sampleRate"]["num"]) | ||
denominator = float(self.pd["timing"]["sampleRate"]["denom"]) | ||
if self.validate_dict_elements(self.pd,["timing","frameRate","num"]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As of today the generated static sample still has this:
"timing": {
"sampleRate": {
"num": 24000,
"denom": 1001
},
Is this changing to "frameRate" via some PR ? If it doesn't this code will fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sampleRate is the current key name in 0.9.1
<tr> | ||
<td>112–127</td> | ||
<td>Checksum (Fletcher16)</td> | ||
<td>2 bytes: A 16-bit checksum computed using the Fletcher-16 algorithm, covering the header and payload (excluding checksum bytes)</td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need to say that you should zero out the checksum when generating the packet?
@makkbe the tests are failing on the 'leader' vs. 'master' change. You should just be able to find replace in test_model.py to get them passing... |
Updates to library, sender, and receiver to match OpenTrackIO 0.9.2.