Browse Source

Better configuration for each arm

tags/v0.3.12-rc0
haixuantao 7 months ago
parent
commit
7391291f68
9 changed files with 52 additions and 15 deletions
  1. +14
    -0
      examples/keyboard/dataflow.yml
  2. +5
    -2
      examples/urdf/franka.yml
  3. +3
    -0
      examples/urdf/kuka.yml
  4. +3
    -0
      examples/urdf/piper.yml
  5. +4
    -1
      examples/urdf/so_arm101.yml
  6. +5
    -0
      examples/urdf/ur5.yml
  7. +6
    -1
      examples/urdf/z1.yml
  8. +1
    -1
      node-hub/dora-pytorch-kinematics/dora_pytorch_kinematics/main.py
  9. +11
    -10
      node-hub/gamepad/gamepad/main.py

+ 14
- 0
examples/keyboard/dataflow.yml View File

@@ -0,0 +1,14 @@
nodes:
- id: keyboard
build: pip install -e ../../node-hub/dora-keyboard
path: dora-keyboard
outputs:
- char
env:
DISPLAY: $DISPLAY

- id: rerun
path: dora-rerun
build: pip install -e ../../node-hub/dora-rerun
inputs:
text_input: keyboard/char

+ 5
- 2
examples/urdf/franka.yml View File

@@ -16,6 +16,9 @@ nodes:
- raw_control - raw_control
inputs: inputs:
tick: dora/timer/millis/10 tick: dora/timer/millis/10
env:
MAX_LINEAR_SPEED: 0.01
MAX_ANGULAR_SPEED: 0.05


- id: pytorch_kinematics - id: pytorch_kinematics
build: pip install -e ../../node-hub/dora-pytorch-kinematics build: pip install -e ../../node-hub/dora-pytorch-kinematics
@@ -28,5 +31,5 @@ nodes:
MODEL_NAME: "panda_description" MODEL_NAME: "panda_description"
END_EFFECTOR_LINK: "panda_link8" END_EFFECTOR_LINK: "panda_link8"
TRANSFORM: "0. 0. 0. 1. 0. 0. 0." TRANSFORM: "0. 0. 0. 1. 0. 0. 0."
POSITION_TOLERANCE: 0.01
ROTATION_TOLERANCE: 0.01
POSITION_TOLERANCE: 0.001
ROTATION_TOLERANCE: 0.001

+ 3
- 0
examples/urdf/kuka.yml View File

@@ -16,6 +16,9 @@ nodes:
- raw_control - raw_control
inputs: inputs:
tick: dora/timer/millis/10 tick: dora/timer/millis/10
env:
MAX_LINEAR_SPEED: 0.02
MAX_ANGULAR_SPEED: 0.10


- id: pytorch_kinematics - id: pytorch_kinematics
build: pip install -e ../../node-hub/dora-pytorch-kinematics build: pip install -e ../../node-hub/dora-pytorch-kinematics


+ 3
- 0
examples/urdf/piper.yml View File

@@ -16,6 +16,9 @@ nodes:
- raw_control - raw_control
inputs: inputs:
tick: dora/timer/millis/10 tick: dora/timer/millis/10
env:
MAX_LINEAR_SPEED: 0.01
MAX_ANGULAR_SPEED: 0.05


- id: pytorch_kinematics - id: pytorch_kinematics
build: pip install -e ../../node-hub/dora-pytorch-kinematics build: pip install -e ../../node-hub/dora-pytorch-kinematics


+ 4
- 1
examples/urdf/so_arm101.yml View File

@@ -16,6 +16,9 @@ nodes:
- raw_control - raw_control
inputs: inputs:
tick: dora/timer/millis/10 tick: dora/timer/millis/10
env:
MAX_LINEAR_SPEED: 0.01
MAX_ANGULAR_SPEED: 0.05


- id: pytorch_kinematics - id: pytorch_kinematics
build: pip install -e ../../node-hub/dora-pytorch-kinematics build: pip install -e ../../node-hub/dora-pytorch-kinematics
@@ -29,4 +32,4 @@ nodes:
END_EFFECTOR_LINK: "gripper" END_EFFECTOR_LINK: "gripper"
TRANSFORM: "0. 0. 0. 1. 0. 0. 0." TRANSFORM: "0. 0. 0. 1. 0. 0. 0."
POSITION_TOLERANCE: 0.01 POSITION_TOLERANCE: 0.01
ROTATION_TOLERANCE: 0.01
ROTATION_TOLERANCE: 0.03

+ 5
- 0
examples/urdf/ur5.yml View File

@@ -16,6 +16,9 @@ nodes:
- raw_control - raw_control
inputs: inputs:
tick: dora/timer/millis/10 tick: dora/timer/millis/10
env:
MAX_LINEAR_SPEED: 0.01
MAX_ANGULAR_SPEED: 0.05


- id: pytorch_kinematics - id: pytorch_kinematics
build: pip install -e ../../node-hub/dora-pytorch-kinematics build: pip install -e ../../node-hub/dora-pytorch-kinematics
@@ -28,3 +31,5 @@ nodes:
MODEL_NAME: "ur5_description" MODEL_NAME: "ur5_description"
END_EFFECTOR_LINK: "tool0" END_EFFECTOR_LINK: "tool0"
TRANSFORM: "0. 0. 0. 1. 0. 0. 0." TRANSFORM: "0. 0. 0. 1. 0. 0. 0."
POSITION_TOLERANCE: 0.001
ROTATION_TOLERANCE: 0.001

+ 6
- 1
examples/urdf/z1.yml View File

@@ -16,6 +16,9 @@ nodes:
- raw_control - raw_control
inputs: inputs:
tick: dora/timer/millis/10 tick: dora/timer/millis/10
env:
MAX_LINEAR_SPEED: 0.01
MAX_ANGULAR_SPEED: 0.05


- id: pytorch_kinematics - id: pytorch_kinematics
build: pip install -e ../../node-hub/dora-pytorch-kinematics build: pip install -e ../../node-hub/dora-pytorch-kinematics
@@ -26,5 +29,7 @@ nodes:
- cmd_vel - cmd_vel
env: env:
MODEL_NAME: "z1_description" MODEL_NAME: "z1_description"
END_EFFECTOR_LINK: "link05"
END_EFFECTOR_LINK: "link06"
TRANSFORM: "0. 0. 0. 1. 0. 0. 0." TRANSFORM: "0. 0. 0. 1. 0. 0. 0."
POSITION_TOLERANCE: 0.001
ROTATION_TOLERANCE: 0.001

+ 1
- 1
node-hub/dora-pytorch-kinematics/dora_pytorch_kinematics/main.py View File

@@ -374,7 +374,7 @@ def main():
target = robot.compute_fk(last_known_state) target = robot.compute_fk(last_known_state)
target = ( target = (
np.array(get_xyz_rpy_array_from_transform3d(target).detach()) np.array(get_xyz_rpy_array_from_transform3d(target).detach())
+ target_vel / 10
+ target_vel
) )
target = pa.array(target.ravel(), type=pa.float32()) target = pa.array(target.ravel(), type=pa.float32())
target = pk.Transform3d( target = pk.Transform3d(


+ 11
- 10
node-hub/gamepad/gamepad/main.py View File

@@ -5,7 +5,11 @@ import json
import pyarrow as pa import pyarrow as pa
import pygame import pygame
from dora import Node from dora import Node
import os


MAX_LINEAR_SPEED = float(os.getenv("MAX_LINEAR_SPEED", "0.05"))
MAX_ANGULAR_SPEED = float(os.getenv("MAX_ANGULAR_SPEED", "0.8"))
JOYSTICK_DEADZONE = float(os.getenv("JOYSTICK_DEADZONE", "0.2"))


class Controller: class Controller:
"""Controller mapping.""" """Controller mapping."""
@@ -50,9 +54,6 @@ def main():


controller = Controller() controller = Controller()


move_speed = 0.05 # Fixed increment for D-pad
max_linear_z_speed = 0.1 # Maximum linear Z speed
max_angular_speed = 0.8 # Maximum angular speed


print(f"Detected controller: {joystick.get_name()}") print(f"Detected controller: {joystick.get_name()}")
print(f"Number of axes: {joystick.get_numaxes()}") print(f"Number of axes: {joystick.get_numaxes()}")
@@ -90,39 +91,39 @@ def main():
# 5. Left stick vertical for rotation around X # 5. Left stick vertical for rotation around X
# 6. Left stick horizontal for rotation around Y # 6. Left stick horizontal for rotation around Y


deadzone = 0.05
deadzone = JOYSTICK_DEADZONE


# Linear X velocity from D-pad vertical # Linear X velocity from D-pad vertical
linear_x = 0.0 linear_x = 0.0
if dpad_y != 0: if dpad_y != 0:
linear_x = dpad_y * move_speed
linear_x = dpad_y * MAX_LINEAR_SPEED


# Linear Y velocity from D-pad horizontal # Linear Y velocity from D-pad horizontal
linear_y = 0.0 linear_y = 0.0
if dpad_x != 0: if dpad_x != 0:
linear_y = dpad_x * move_speed
linear_y = dpad_x * MAX_LINEAR_SPEED


# Linear Z velocity from right stick vertical # Linear Z velocity from right stick vertical
right_y = -joystick.get_axis(controller.axisNames["RIGHT-Y"]) right_y = -joystick.get_axis(controller.axisNames["RIGHT-Y"])
right_y = 0.0 if abs(right_y) < deadzone else right_y right_y = 0.0 if abs(right_y) < deadzone else right_y
linear_z = right_y * max_linear_z_speed
linear_z = right_y * MAX_LINEAR_SPEED


# Angular Z velocity (rotation) from right stick horizontal # Angular Z velocity (rotation) from right stick horizontal
right_x = -joystick.get_axis(controller.axisNames["RIGHT-X"]) right_x = -joystick.get_axis(controller.axisNames["RIGHT-X"])
right_x = 0.0 if abs(right_x) < deadzone else right_x right_x = 0.0 if abs(right_x) < deadzone else right_x
angular_z = ( angular_z = (
right_x * max_angular_speed
right_x * MAX_ANGULAR_SPEED
) # TODO: Make z non zero, but on my gamepad the value is never zero ) # TODO: Make z non zero, but on my gamepad the value is never zero


# Angular X velocity from left stick vertical # Angular X velocity from left stick vertical
left_y = -joystick.get_axis(controller.axisNames["LEFT-Y"]) left_y = -joystick.get_axis(controller.axisNames["LEFT-Y"])
left_y = 0.0 if abs(left_y) < deadzone else left_y left_y = 0.0 if abs(left_y) < deadzone else left_y
angular_x = left_y * max_angular_speed
angular_x = left_y * MAX_ANGULAR_SPEED


# Angular Y velocity from left stick horizontal # Angular Y velocity from left stick horizontal
left_x = -joystick.get_axis(controller.axisNames["LEFT-X"]) left_x = -joystick.get_axis(controller.axisNames["LEFT-X"])
left_x = 0.0 if abs(left_x) < deadzone else left_x left_x = 0.0 if abs(left_x) < deadzone else left_x
angular_y = left_x * max_angular_speed
angular_y = left_x * MAX_ANGULAR_SPEED


cmd_vel = [linear_x, linear_y, linear_z, angular_x, angular_y, angular_z] cmd_vel = [linear_x, linear_y, linear_z, angular_x, angular_y, angular_z]
if any(cmd_vel): if any(cmd_vel):


Loading…
Cancel
Save