Skip to content
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

Closed
wants to merge 18 commits into from
Closed

Updates for v0.9.2 #142

wants to merge 18 commits into from

Conversation

makkbe
Copy link
Contributor

@makkbe makkbe commented Dec 20, 2024

Updates to library, sender, and receiver to match OpenTrackIO 0.9.2.


# 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)
Copy link
Contributor

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 = {
Copy link
Contributor

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"""
Copy link
Contributor

@steverdevel steverdevel Dec 21, 2024

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()
Copy link
Contributor

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.
Copy link
Contributor

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"]):
Copy link
Contributor

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.

Copy link
Collaborator

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>
Copy link
Contributor

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?

@jamesmosys
Copy link
Collaborator

@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...

@makkbe makkbe closed this Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants