mirror of
https://github.com/apirrone/Open_Duck_Mini_Runtime.git
synced 2025-09-03 03:33:54 +00:00
head mix
This commit is contained in:
parent
c04594bf32
commit
2817727475
3 changed files with 16 additions and 4 deletions
|
@ -182,8 +182,11 @@ class HWI:
|
|||
# present_positions = np.deg2rad(
|
||||
# self.control.io.get_present_position(self.joints.values())
|
||||
# )
|
||||
|
||||
present_positions = self.io.read_present_position(list(self.joints.values()))
|
||||
try:
|
||||
present_positions = self.io.read_present_position(list(self.joints.values()))
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return None
|
||||
# present_positions = np.deg2rad(self.control.get_present_position())
|
||||
present_positions = [
|
||||
pos - self.joints_offsets[joint]
|
||||
|
@ -196,7 +199,11 @@ class HWI:
|
|||
"""
|
||||
Returns the present velocities in rad/s (default) or rev/min
|
||||
"""
|
||||
present_velocities = self.io.read_present_velocity(list(self.joints.values()))
|
||||
try:
|
||||
present_velocities = self.io.read_present_velocity(list(self.joints.values()))
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return None
|
||||
# present_velocities = np.array(self.control.get_current_speed())
|
||||
present_velocities = [
|
||||
vel
|
||||
|
|
|
@ -47,6 +47,8 @@ try:
|
|||
hwi.set_position_all(hwi.zero_pos)
|
||||
time.sleep(0.5)
|
||||
current_pos = hwi.get_present_positions()[i]
|
||||
if current_pos is None:
|
||||
continue
|
||||
# hwi.control.kps[i] = 0
|
||||
hwi.io.disable_torque([joint_id])
|
||||
input(
|
||||
|
|
|
@ -157,6 +157,9 @@ class RLWalk:
|
|||
]
|
||||
) # rad/s
|
||||
|
||||
if dof_pos is None or dof_vel is None:
|
||||
return None
|
||||
|
||||
if len(dof_pos) != self.num_dofs:
|
||||
print(f"ERROR len(dof_pos) != {self.num_dofs}")
|
||||
return None
|
||||
|
@ -290,7 +293,7 @@ class RLWalk:
|
|||
self.motor_targets = filtered_motor_targets
|
||||
|
||||
self.prev_motor_targets = self.motor_targets.copy()
|
||||
|
||||
|
||||
head_motor_targets = self.last_commands[3:] + self.motor_targets[5:9]
|
||||
self.motor_targets[5:9] = head_motor_targets
|
||||
|
||||
|
|
Loading…
Reference in a new issue