Browse Source

Add inference and record desktop app

tags/0.3.8-rc
haixuanTao haixuantao 1 year ago
parent
commit
1d1fff0e4c
5 changed files with 47 additions and 4 deletions
  1. +7
    -0
      examples/piper/inference.desktop
  2. +10
    -0
      examples/piper/inference.sh
  3. +13
    -4
      examples/piper/post_process_action.py
  4. +7
    -0
      examples/piper/record.desktop
  5. +10
    -0
      examples/piper/record.sh

+ 7
- 0
examples/piper/inference.desktop View File

@@ -0,0 +1,7 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=Inference
Exec=bash -c "/home/agilex/Desktop/inference.sh; sleep 5"
Terminal=true
Categories=Application

+ 10
- 0
examples/piper/inference.sh View File

@@ -0,0 +1,10 @@
#!/bin/bash
if ! ifconfig | grep -q "can_left"; then
source /home/agilex/cobot_magic/Piper_ros_private-ros-noetic/can_config.sh
fi
sleep 5
export PYTHONPATH=$PYTHONPATH:/home/agilex/1ms.ai/pyorbbecsdk/install/lib/:/home/agilex/1ms.ai/ugv_sdk
source /home/agilex/miniconda3/etc/profile.d/conda.sh
pkill dora
conda activate dora
dora run /home/agilex/1ms.ai/dora/examples/piper/inference.yml

+ 13
- 4
examples/piper/post_process_action.py View File

@@ -10,12 +10,21 @@ import pyarrow as pa

for event in node:
if event["type"] == "INPUT":
actions = event["value"].to_numpy().reshape((64, 14))

# Skip action to only keep 8 spread action
actions = actions[[0, 8, 16, 24, 32, 40, 48, 56], :]
actions = event["value"].to_numpy().copy().reshape((64, 14))

for action in actions:
gripper_left = action[6]
gripper_right = action[13]
if gripper_right < 0.45:
action[13] = 0.3
else:
action[13] = 0.6

if gripper_left < 0.45:
action[6] = 0.3
else:
action[6] = 0.6

node.send_output("jointstate_left", pa.array(action[:7], type=pa.float32()))
node.send_output(
"jointstate_right", pa.array(action[7:], type=pa.float32())


+ 7
- 0
examples/piper/record.desktop View File

@@ -0,0 +1,7 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=Record
Exec=bash -c "/home/agilex/Desktop/record.sh; sleep 5"
Terminal=true
Categories=Application

+ 10
- 0
examples/piper/record.sh View File

@@ -0,0 +1,10 @@
#!/bin/bash
if ! ifconfig | grep -q "can_left"; then
source /home/agilex/cobot_magic/Piper_ros_private-ros-noetic/can_config.sh
fi
sleep 5
export PYTHONPATH=$PYTHONPATH:/home/agilex/1ms.ai/pyorbbecsdk/install/lib/:/home/agilex/1ms.ai/ugv_sdk
source /home/agilex/miniconda3/etc/profile.d/conda.sh
pkill dora
conda activate dora
dora run /home/agilex/1ms.ai/dora/examples/piper/record.yml

Loading…
Cancel
Save