mirror of
https://github.com/wassname/pyrobolearn.git
synced 2026-09-09 11:31:38 +08:00
update robots + add shadow hand + units converter
This commit is contained in:
@@ -7,6 +7,8 @@ from itertools import count
|
||||
from pyrobolearn.simulators import BulletSim
|
||||
from pyrobolearn.worlds import BasicWorld
|
||||
from pyrobolearn.robots import Quadcopter
|
||||
from pyrobolearn.utils.units import rpm_to_rad_per_second
|
||||
|
||||
|
||||
# Create simulator
|
||||
sim = BulletSim()
|
||||
@@ -20,9 +22,9 @@ robot = Quadcopter(sim)
|
||||
# print information about the robot
|
||||
robot.print_info()
|
||||
|
||||
rpm = robot.getStationaryRPM()
|
||||
rpm = robot.get_stationary_rpm()
|
||||
print("Stationary RPM: {}".format(rpm))
|
||||
v = robot.rpmToRadPerSecond(rpm+20)
|
||||
v = rpm_to_rad_per_second(rpm+20)
|
||||
v = [v, -v, v, -v]
|
||||
|
||||
# run simulation
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"""Load the RRBot robotic platform.
|
||||
"""
|
||||
|
||||
import numpy as np
|
||||
from itertools import count
|
||||
from pyrobolearn.simulators import BulletSim
|
||||
from pyrobolearn.worlds import BasicWorld
|
||||
@@ -93,7 +94,7 @@ raw_input('press enter')
|
||||
print(robot.get_link_names())
|
||||
force = np.array([1., 0., 0.])
|
||||
pos = np.array([0., 0., 0.])
|
||||
sim.apply_external_force(robot.id, 1, force, pos, flags=p.LINK_FRAME) # link_frame = 1
|
||||
sim.apply_external_force(robot.id, 1, force, pos, frame=1) # link_frame = 1, world_frame = 2
|
||||
|
||||
slider = sim.add_user_debug_parameter('force', -1000., 1000., 0)
|
||||
|
||||
@@ -102,7 +103,7 @@ J = sim.calculate_jacobian(robot.id, 1, [0., 0., 0.])
|
||||
print(np.array(J[0]))
|
||||
|
||||
a = robot.get_joint_positions()
|
||||
# print(robot.getJacobianMatrix(1, np.array([0.,0.]))) # TODO: need to convert numpy array to list
|
||||
# print(robot.get_jacobian(1, np.array([0.,0.]))) # TODO: need to convert numpy array to list
|
||||
|
||||
linkId = 2
|
||||
com_frame = robot.get_link_states(linkId)[2]
|
||||
@@ -144,7 +145,7 @@ for i in range(10000):
|
||||
force = np.array([0., 0., 1.])
|
||||
else:
|
||||
force = np.array([0., 0., 0.])
|
||||
sim.apply_external_force(robot.id, linkId, force, pos, flags=p.LINK_FRAME) # p.LINK_FRAME = 1
|
||||
sim.apply_external_force(robot.id, linkId, force, pos, frame=1) # p.LINK_FRAME = 1, p.WORLD_FRAME = 2
|
||||
|
||||
# robot.update_joint_slider()
|
||||
world.step(sleep_dt=1./240)
|
||||
|
||||
Reference in New Issue
Block a user