MCPcopy Create free account
hub / github.com/TeleHuman/TextOp / get_projected_gravity

Function get_projected_gravity

TextOpTracker/scripts/deploy_mujoco.py:575–590  ·  view source on GitHub ↗

Get projected gravity

(sim_data)

Source from the content-addressed store, hash-verified

573
574
575def get_projected_gravity(sim_data):
576 """Get projected gravity"""
577 quaternion = sim_data.qpos[3:7] # wxyz
578
579 qw = quaternion[0]
580 qx = quaternion[1]
581 qy = quaternion[2]
582 qz = quaternion[3]
583
584 gravity_orientation = np.zeros(3)
585
586 gravity_orientation[0] = 2 * (-qz * qx + qw * qy)
587 gravity_orientation[1] = -2 * (qz * qy + qw * qx)
588 gravity_orientation[2] = 1 - 2 * (qw * qw + qz * qz)
589
590 return gravity_orientation
591
592
593#

Callers 2

compute_observationMethod · 0.85
compute_observationFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected