Skip to content

Commit

Permalink
fix: add yaw angle conversion from Blender (CCW) to Skybrush (CW) rep…
Browse files Browse the repository at this point in the history
…resentation
  • Loading branch information
vasarhelyi committed Dec 6, 2024
1 parent 055f795 commit dbe17c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/modules/sbstudio/model/yaw.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class YawSetpoint:
"""The timestamp associated to the yaw setpoint, in seconds."""

angle: float
"""The yaw angle associated to the yaw setpoint, in degrees."""
"""The yaw angle associated to the yaw setpoint, in degrees, CW."""


class YawSetpointList:
Expand Down
9 changes: 5 additions & 4 deletions src/modules/sbstudio/plugin/utils/sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ def sample_positions_and_yaw_of_objects(
for obj in objects:
key = obj.name if by_name else obj
trajectories[key].append(Point4D(time, *get_position_of_object(obj)))
yaw_setpoints[key].append(
YawSetpoint(time, get_xyz_euler_rotation_of_object(obj)[2])
)
rotation = get_xyz_euler_rotation_of_object(obj)
# note the conversion from Blender CCW to Skybrush CW representation
yaw_setpoints[key].append(YawSetpoint(time, -rotation[2]))

# Ensure that the yaw curve makes sense even if the extracted yaw angles
# "wrap around" the boundary between -180 and 180 degrees
Expand Down Expand Up @@ -318,7 +318,8 @@ def sample_positions_colors_and_yaw_of_objects(
_to_int_255(color[2]),
)
)
yaw_setpoints[key].append(YawSetpoint(time, rotation[2]))
# note the conversion from Blender CCW to Skybrush CW representation
yaw_setpoints[key].append(YawSetpoint(time, -rotation[2]))

# Ensure that the yaw curve makes sense even if the extracted yaw angles
# "wrap around" the boundary between -180 and 180 degrees
Expand Down

0 comments on commit dbe17c5

Please sign in to comment.