-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #220 from NOSALRO/robot_examples
Updated Supported Robots
- Loading branch information
Showing
13 changed files
with
233 additions
and
18 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import RobotDART as rd | ||
import time | ||
import numpy as np | ||
dt = 0.001 | ||
simu = rd.RobotDARTSimu(dt) | ||
|
||
# this is important for wheel collision; with FCL it does not work well | ||
simu.set_collision_detector("bullet") | ||
|
||
freq = int(1//dt) | ||
# @TIAGO_PYTHON@ | ||
robot = rd.Tiago(freq) | ||
# @TIAGO_PYTHON_END@ | ||
print("the model used is [", robot.model_filename(), "]") | ||
|
||
configuration = rd.gui.GraphicsConfiguration() | ||
configuration.width = 1280 | ||
configuration.height = 960 | ||
configuration.bg_color = [1.0, 1.0, 1.0, 1.0] | ||
graphics = rd.gui.Graphics(configuration) | ||
simu.set_graphics(graphics) | ||
graphics.look_at([0., 3., 2.], [0., 0., 0.25]) | ||
graphics.record_video("tiago_dancing.mp4") | ||
|
||
simu.add_checkerboard_floor() | ||
simu.add_robot(robot) | ||
|
||
simu.set_control_freq(freq) | ||
wheel_dofs = ["wheel_right_joint", "wheel_left_joint"] | ||
arm_dofs = ["arm_1_joint", | ||
"arm_2_joint", | ||
"arm_3_joint", | ||
"arm_4_joint", | ||
"arm_5_joint", | ||
"torso_lift_joint"] | ||
|
||
init_positions = robot.positions(arm_dofs) | ||
start = time.time() | ||
|
||
while (simu.scheduler().next_time() < 20. and not simu.graphics().done()): | ||
if (simu.schedule(simu.control_freq())): | ||
delta_pos = [np.sin(simu.scheduler().current_time() * 2) + np.pi/2, | ||
np.sin(simu.scheduler().current_time() * 2), | ||
np.sin(simu.scheduler().current_time() * 2), | ||
np.sin(simu.scheduler().current_time() * 2), | ||
np.sin(simu.scheduler().current_time() * 2), | ||
np.sin(simu.scheduler().current_time() * 2)] | ||
commands = (init_positions + delta_pos) - robot.positions(arm_dofs) | ||
robot.set_commands(commands, arm_dofs) | ||
cmd = [0, 5] | ||
robot.set_commands(cmd, wheel_dofs) | ||
simu.step_world() | ||
|
||
end = time.time() | ||
elapsed_seconds = end - start | ||
print("benchmark time: ", elapsed_seconds, " s") | ||
robot.reset() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import RobotDART as rd | ||
|
||
# @VX300_PYTHON@ | ||
robot = rd.Vx300() | ||
# @VX300_PYTHON_END@ | ||
robot.set_actuator_types("servo") | ||
|
||
ctrl = [0.0, 1.0, -1.5, 1.0, 0.5, 0.] | ||
|
||
controller = rd.PDControl(ctrl) | ||
robot.add_controller(controller) | ||
|
||
simu = rd.RobotDARTSimu() | ||
simu.set_collision_detector("fcl") | ||
|
||
simu.set_graphics(rd.gui.Graphics()) | ||
simu.add_robot(robot) | ||
simu.add_checkerboard_floor() | ||
|
||
for n in robot.dof_names(): | ||
print(n) | ||
|
||
simu.run(2.5) | ||
|
||
ctrl = [0.0, -0.5, 0.5, -0.5, 0., 1.] | ||
controller.set_parameters(ctrl) | ||
controller.set_pd(20., 0.) | ||
simu.run(2.5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters