Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def set_moving_base_xform(robot,R,t):
"""For a moving base robot model, set the current base rotation
matrix R and translation t. (Note: if you are controlling a robot
during simulation, use send_moving_base_xform_command)
"""
q = robot.getConfig()
for i in range(3):
q[i] = t[i]
roll,pitch,yaw = so3.rpy(R)
q[3]=yaw
q[4]=pitch
q[5]=roll
robot.setConfig(q)
def send_moving_base_xform_linear(controller,R,t,dt):
"""For a moving base robot model, send a command to move to the
rotation matrix R and translation t using linear interpolation
over the duration dt.
Note: with the reflex model, can't currently set hand commands
and linear base commands simultaneously
"""
q = controller.getCommandedConfig()
for i in range(3):
q[i] = t[i]
roll,pitch,yaw = so3.rpy(R)
q[3]=yaw
q[4]=pitch
q[5]=roll
controller.setLinear(q,dt)
def send_moving_base_xform_PID(controller,R,t):
"""For a moving base robot model, send a command to move to the
rotation matrix R and translation t by setting the PID setpoint
Note: with the reflex model, can't currently set hand commands
and linear base commands simultaneously
"""
q = controller.getCommandedConfig()
for i in range(3):
q[i] = t[i]
roll,pitch,yaw = so3.rpy(R)
q[3]=yaw
q[4]=pitch
q[5]=roll
v = controller.getCommandedVelocity()
controller.setPIDCommand(q,v)