From a4b91f9d0768ef60033585269eb3cc06e7092f61 Mon Sep 17 00:00:00 2001 From: ziyanx02 Date: Fri, 20 Dec 2024 00:06:04 -0500 Subject: [PATCH] test precommit --- examples/rigid/apply_external_force_torque.py | 70 ------------------- 1 file changed, 70 deletions(-) delete mode 100644 examples/rigid/apply_external_force_torque.py diff --git a/examples/rigid/apply_external_force_torque.py b/examples/rigid/apply_external_force_torque.py deleted file mode 100644 index 0e587d6e..00000000 --- a/examples/rigid/apply_external_force_torque.py +++ /dev/null @@ -1,70 +0,0 @@ -import argparse - -import numpy as np - -import genesis as gs -from genesis.engine.solvers.rigid.rigid_solver_decomp import RigidSolver - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument("-v", "--vis", action="store_true", default=False) - args = parser.parse_args() - - ########################## init ########################## - gs.init(backend=gs.gpu) - - ########################## create a scene ########################## - viewer_options = gs.options.ViewerOptions( - camera_pos=(0, -3.5, 2.5), - camera_lookat=(0.0, 0.0, 1.0), - camera_fov=40, - max_FPS=60, - ) - - scene = gs.Scene( - viewer_options=viewer_options, - sim_options=gs.options.SimOptions( - dt=0.01, - ), - show_viewer=args.vis, - ) - - ########################## entities ########################## - plane = scene.add_entity( - gs.morphs.Plane(), - ) - cube = scene.add_entity( - gs.morphs.Box( - pos=(0, 0, 1.0), - size=(0.2, 0.2, 0.2), - ), - ) - ########################## build ########################## - scene.build() - - for solver in scene.sim.solvers: - if not isinstance(solver, RigidSolver): - continue - rigid_solver = solver - - rotation_direction = 1 - # PD control - for i in range(1000): - - cube_pos = rigid_solver.get_links_pos([1,]) - cube_pos[:, 2] -= 1 - force = -200 * cube_pos - rigid_solver.apply_links_external_force(force=force, links_idx=[1,]) - - torque = [[0, 0, rotation_direction * 5],] - rigid_solver.apply_links_external_torque(torque=torque, links_idx=[1,]) - - scene.step() - - if (i + 50) % 100 == 0: - rotation_direction *= -1 - - -if __name__ == "__main__": - main()