) # returns desired [position, velocity] target = path_planner.next() if use_force_control: # generate an operational space control signal u = ctrlr.generate( q=feedback["q"], dq=feedback["dq"], target=target[0], target_velocity=target[1], ) # apply the control signal, step the sim forward interface.send_forces(u, update_display=True if count % 20 == 0 else False) else: # use position control interface.send_target_angles( target[: robot_config.N_JOINTS], update_display=True if count % 20 == 0 else False, ) count += 1 finally: # stop and reset the simulation interface.disconnect() print("Simulation terminated...")
) # returns desired [position, velocity] target = path_planner.next() if use_force_control: # generate an operational space control signal u = ctrlr.generate( q=feedback["q"], dq=feedback["dq"], target=target[0], target_velocity=target[1], ) # apply the control signal, step the sim forward interface.send_forces(u, update_display=(count % 20 == 0)) else: # use position control interface.send_target_angles( target[:robot_config.N_JOINTS], update_display=(count % 20 == 0), ) count += 1 finally: # stop and reset the simulation interface.disconnect() print("Simulation terminated...")