Skip to content

Commit

Permalink
update 1.3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaxaxx committed Jun 5, 2024
1 parent 37d3fd1 commit bd10962
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "rocs_client"
version = "1.3.9"
version = "1.3.10"
authors = [{name = "jax", email = "ming.li@fftai.com"}]
license = {text = "MIT"}
requires-python = ">=3.8"
Expand Down
37 changes: 37 additions & 0 deletions rocs_client/robot/human.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,43 @@ def head(self, roll: float, pitch: float, yaw: float):
}
})

def waist(self, roll: float, pitch: float, yaw: float):
"""
Control the movement of the robot's waist via a long-lived connection.
Args:
roll (float): Rotation around the x-axis. Negative values turn the head to the left,
and positive values turn it to the right. Range: -17.1887 to 17.1887.
pitch (float): Rotation around the y-axis. Positive values tilt the head forward,
and negative values tilt it backward. Range: -17.1887 to 17.1887.
yaw (float): Rotation around the z-axis. Negative values twist the head to the left,
and positive values twist it to the right. Range: -17.1887 to 17.1887.
Returns:
None
Raises:
Any exceptions raised during the execution.
Notes:
- The request is sent via a long-lived connection.
- The roll, pitch, and yaw values are automatically adjusted to fit within the specified valid ranges if they go beyond the given thresholds.
Example:
To turn the robot's head to the right (roll), tilt it backward (pitch), and twist it to the left (yaw):
>>> Human.waist(roll=10.0, pitch=-5.0, yaw=-7.0)
"""

self._send_websocket_msg({
'command': 'waist',
'data': {
'roll': self._cover_param(roll, "roll", -17.1887, 17.1887),
'pitch': self._cover_param(pitch, "pitch", -17.1887, 17.1887),
'yaw': self._cover_param(yaw, "yaw", -17.1887, 17.1887)
}
})

def upper_body(self, arm: ArmAction = None, hand: HandAction = None):
"""
Execute predefined upper body actions by setting arm and hand movements.
Expand Down
7 changes: 6 additions & 1 deletion test/test_human.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async def on_error(error: Exception):


class TestHuman(unittest.TestCase):
human = Human(on_connected=on_connected, host="127.0.0.1", on_message=on_message, on_close=on_close,
human = Human(on_connected=on_connected, host="192.168.12.1", on_message=on_message, on_close=on_close,
on_error=on_error)

def test_enable_debug_state(self):
Expand Down Expand Up @@ -111,3 +111,8 @@ def test_close_control_svr(self):
def test_status_control_svr(self):
print('test_status_control_svr: ', self.human._control_svr_status())
self.human.exit()

def test_waist(self):
self.human.waist(0, 0, 0)
time.sleep(5)
self.human.exit()
10 changes: 5 additions & 5 deletions test/test_motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from rocs_client import Motor

motor = Motor(host="192.168.137.210")
motor = Motor(host="192.168.12.1")

arm_motor = motor.limits[0:17] if len(motor.limits) > 18 else []
clamping_jaw = motor.limits[17:19] if len(motor.limits) > 20 else []
Expand All @@ -15,7 +15,7 @@
print(f'clamping_jaw: {clamping_jaw}')
print(f'dexterous_hand: {dexterous_hand}')

motors = arm_motor + clamping_jaw
motors = arm_motor + dexterous_hand


def set_pds_flag():
Expand Down Expand Up @@ -246,7 +246,7 @@ def test_move3(self):
enable_all()

for i in range(1, 5):
smooth_motion_by_interpolation('3', 'right', 10)
smooth_motion_by_interpolation('3', 'right', -10)
smooth_motion_by_interpolation('0', 'yaw', 30)
smooth_motion_by_interpolation('0', 'yaw', -30)

disable_all()
# disable_all()

0 comments on commit bd10962

Please sign in to comment.