[Linux!] Use newest Android Studio with Pepper Emulator

Gepostet 4 Monate her von Lukas Brandt

Ein Thema veröffentlichen
Gelöst

At this point I am using Ubuntu Linux, but it cannot be ruled out that the process is also possible in a similar form on other distributions.

To ensure that the Pepper emulator generally works under Linux, the following article can be followed:
https://support.unitedrobotics.group/de/support/discussions/topics/80000657899

It is important to note that the Pepper SDK can only be installed up to Android Studio Flamingo | 2022.2.1 Patch 2 without Android Studio crashing. You can read my article here:
https://support.unitedrobotics.group/de/support/discussions/topics/80000660961

If you have already installed the PepperSDK, you can find it under
/home/$USER/.local/share/Softbank Robotics/RobotSDK
the SDK folder, which in turn contains the API 7 folder.


At this point, I have copied a copy of the "RobotSDK" folder to another location of my choice, maybe ~/Documents/RobotSDK.

The next step is to uninstall and remove the PepperSDK from Android Studio. The latest version of Android Studio can then be installed.


Important!

  • Since the PepperSDK has been uninstalled, there are of course no more buttons for starting the emulator or connecting to a real robot:
  • to connect to a real robot you can now simply use the adb command "adb connect".
  • Adding the required robot components must now be done manually, such as adding the Maven repository, which has generally changed in newer Android Studio. You can read the following article:
    https://support.unitedrobotics.group/de/support/discussions/topics/80000657415


To start the Android emulator for Pepper now, the following script can be used, which should be stored directly in the "RobotSDK" folder that we saved previously.
The script should first be made executable with chmod +x and can then be executed with ./script.sh.


#!/bin/bash

# check if netstat is installed
if ! command -v netstat &> /dev/null; then
  echo "netstat is not installed. Please install netstat and try again. try sudo apt install net-tools"
  exit 1
fi

# Get the Path of the Script
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

echo "Script directory: $SCRIPT_DIR"

# Check if QI_WRITABLE is set
if [ -z "$QI_WRITABLE_PATH" ]; then
  export QI_WRITABLE_PATH="$SCRIPT_DIR/API 7/naoqi-config/"
else
  export QI_WRITABLE_PATH="$QI_WRITABLE_PATH:$SCRIPT_DIR/API 7/naoqi-config/"
fi

echo "QI_WRITABLE_PATH: $QI_WRITABLE_PATH"

# Starts naoqi-bin with URL
"$SCRIPT_DIR/API 7/tools/bin/naoqi-bin" --qi-listen-url tcp://127.0.0.1:9570 &

# save PID of the NAOQI Process
NAOQI_PID=$!

# Check if Server is running on Port
function check_port() {
  netstat -an | grep 9570 | grep LISTEN
}

# Wait, for Server running on Port 9570
echo "Waiting for the server to start..."
while ! check_port; do
  sleep 1
done

echo "Server is running. Start the other program..."

"$SCRIPT_DIR/API 7/tools/bin/robot_viewer" 127.0.0.1 9559 &

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$HOME/Android/Sdk/emulator/":"$HOME/Android/Sdk/emulator/lib64/gles_swiftshader":"$HOME/Android/Sdk/emulator/lib64":"$HOME/Android/Sdk/emulator/lib64/qt/lib":"$HOME/Android/Sdk/emulator/lib":"$HOME/Android/Sdk/emulator/lib/qt/lib"

nohup "$HOME/Android/Sdk/emulator/qemu/linux-x86_64/qemu-system-i386" \
  -sysdir "$SCRIPT_DIR/API 7/avd/x86" \
  -kernel "$SCRIPT_DIR/API 7/avd/x86/kernel-ranchu" \
  -system "$SCRIPT_DIR/API 7/avd/x86/system.img" \
  -ramdisk "$SCRIPT_DIR/API 7/avd/x86/ramdisk.img" \
  -data "$SCRIPT_DIR/API 7/avd/x86/userdata.img" \
  -cache "$SCRIPT_DIR/API 7/avd/x86/cache.img" \
  -skin 1280x800 -ports "5575, 5579" \
  -sdcard "$SCRIPT_DIR/API 7/avd/x86/sd-card.img" \
  -gpu host \
  -vendor "vendor-qemu.img" </dev/null >/dev/null 2>&1 &

wait $NAOQI_PID


0 Stimmen


0 Kommentare

Anmelden oder Registrieren um einen Kommentar zu veröffentlichen