Skip to content

Commit

Permalink
Merge pull request #1528 from k-okada/pepper_cross
Browse files Browse the repository at this point in the history
add cross-compile environment for pepper robot
  • Loading branch information
k-okada authored Aug 15, 2022
2 parents 1f44c97 + 8d8483a commit 25b9f6a
Show file tree
Hide file tree
Showing 94 changed files with 3,757 additions and 110 deletions.
4 changes: 4 additions & 0 deletions .travis.rosinstall.kinetic
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
local-name: fetchrobotics/fetch_ros
uri: https://github.com/fetchrobotics/fetch_ros.git
version: 0ad250a996a2ef68172fc064698f253bc9cf08d0
- git:
local-name: visualization_rwt/rwt_app_chooser
uri: https://github.com/tork-a/visualization_rwt-release.git
version: release/melodic/rwt_app_chooser/0.1.1-1
# Remove this dependency if jsk_common version 2.2.12 is released in kinetic
# See https://github.com/jsk-ros-pkg/jsk_robot/pull/1481#issuecomment-1209544704
- git:
Expand Down
143 changes: 53 additions & 90 deletions jsk_naoqi_robot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export ROS_IP="133.11.216.yyy" % OR run rossetip command to set ROS_IP
mkdir -p catkin_ws/src
cd catkin_ws
wstool init src
wstool merge -t src https://raw.githubusercontent.com/jsk-ros-pkg/jsk_robot/master/jsk_naoqi_robot/pepper.rosinstall
wstool merge -t src https://raw.githubusercontent.com/jsk-ros-pkg/jsk_robot/master/jsk_naoqi_robot/naoqi.rosinstall
wstool update -t src
source /opt/ros/${ROS_DISTRO}/setup.bash
rosdep install -y -r --from-paths src --ignore-src
Expand All @@ -105,24 +105,15 @@ sudo apt-get install ros-${ROS_DISTRO}-pepper-meshes
sudo apt-get install ros-${ROS_DISTRO}-nao-meshes
```

If you have ROS >= kinetic, please use [naoqi_dashboard (kochigami-develop)](https://github.com/kochigami/naoqi_dashboard/tree/kochigami-develop).
This includes [Important PR](https://github.com/ros-naoqi/naoqi_dashboard/pull/3) for ROS >= kinetic.

```
cd catkin_ws/src
wstool set naoqi_dashboard --git https://github.com/ros-naoqi/naoqi_dashboard
wstool update naoqi_dashboard
cd naoqi_dashboard
git remote add kochigami https://github.com/kochigami/naoqi_dashboard.git
git fetch kochigami
git checkout -b modify-for-kinetic kochigami/kochigami-develop
```
Note that `naoqi.rosinstall` includes necessary patches for ROS kinetic, such as [naoqi_dashboard (kochigami-develop)](https://github.com/kochigami/naoqi_dashboard/tree/kochigami-develop).

Finally, please compile them.

```
cd ../.. # catkin_ws
catkin build --continue-on-failure
catkin build peppereus
catkin build jsk_pepper_startup
catkin build naoeus
catkin build jsk_nao_startup
source devel/setup.bash
```

Expand All @@ -131,89 +122,29 @@ source devel/setup.bash

4. (optional) For NAO and Pepper developers

Please add following source codes which you need for debugging.
Confirm that you get the following output when you type `wstool info`

```
cd catkin_ws/src
wstool set nao_robot --git https://github.com/ros-naoqi/nao_robot
(if you use ROS >= melodic) wstool update nao_robot
wstool set pepper_robot --git https://github.com/ros-naoqi/pepper_robot
wstool set naoqi_driver --git https://github.com/ros-naoqi/naoqi_driver
wstool update naoqi_driver
wstool set naoqi_bridge --git https://github.com/ros-naoqi/naoqi_bridge
wstool set naoqi_bridge_msgs --git https://github.com/ros-naoqi/naoqi_bridge_msgs
```

5. (optional) If you want to use [`ros_speech_recognition`](https://github.com/jsk-ros-pkg/jsk_3rdparty/tree/master/ros_speech_recognition) with NAO microphone
$ cd ~/catkin_ws/src
$ wstool info
workspace: /home/leus/catkin_ws/src
Please check the version of ros-$ROS_DISTRO-ros-speech-recognition

```
sudo apt update
apt search ros-$ROS_DISTRO-ros-speech-recognition
Localname S SCM Version (Spec) UID (Spec) URI (Spec) [http(s)://...]
--------- - --- -------------- ----------- ---------------------------
pepper_robot git master (-) efad3979b374 github.com/ros-naoqi/pepper_robot
naoqi_driver M git kochigami-develop 98c0b678286a github.com/kochigami/naoqi_driver
naoqi_dashboard git kochigami-develop 33962f146c77 github.com/kochigami/naoqi_dashboard
naoqi_bridge_msgs git kochigami-develop d7417613690e github.com/kochigami/naoqi_bridge_msgs
naoqi_bridge git kochigami-develop c28b727e1e9b github.com/kochigami/naoqi_bridge
nao_robot git master (-) 67476469a137 github.com/ros-naoqi/nao_robot
nao_interaction git master (-) f97ad12f3896 github.com/ros-naoqi/nao_interaction
jsk_robot git master 1f44c97c7855 github.com/jsk-ros-pkg/jsk_robot.git
```

If version of ros_speech_recognition < 2.1.18

```
cd catkin_ws/src
mkdir ros_speech_recognition
cd ros_speech_recognition
git init
git config core.sparsecheckout true
git remote add origin https://github.com/jsk-ros-pkg/jsk_3rdparty.git
echo ros_speech_recognition > .git/info/sparse-checkout
git pull origin master
cd ../..
catkin build ros_speech_recognition
source devel/setup.bash
```

If version of ros_speech_recognition >=2.1.18
```
sudo apt-get install ros-$ROS_DISTRO-ros-speech-recognition
```


## Interface when controlling NAO and Pepper via roseus

Common methods for NAO and Pepper are defined in `naoqieus/naoqi-interface.l`. NAO-specific methods are defined in `naoeus/nao-interface.l`. Pepper-specific methods are defined in `peppereus/pepper-interface.l`. For further details about each method, please refer to [**_naoqieus_**](naoqieus/README.md), [**_naoeus_**](naoeus/README.md), and [**_peppereus_**](peppereus/README.md) respectively.
For some methods, they require specific branch (kochigami-develop) because they are not merged into master. If you need this, please change your branch of `naoqi_bridge` and `naoqi_bridge_msgs` as follows:

```
cd catkin_ws/src
wstool set naoqi_bridge --git https://github.com/ros-naoqi/naoqi_bridge
wstool update naoqi_bridge
cd naoqi_bridge
git remote add kochigami https://github.com/kochigami/naoqi_bridge.git
git fetch kochigami
git checkout -b kochigami-develop kochigami/kochigami-develop
cd .. # catkin_ws/src
wstool set naoqi_bridge_msgs --git https://github.com/ros-naoqi/naoqi_bridge_msgs
wstool update naoqi_bridge_msgs
cd naoqi_bridge_msgs
git remote add kochigami https://github.com/kochigami/naoqi_bridge_msgs.git
git fetch kochigami
git checkout -b kochigami-develop kochigami/kochigami-develop
```

In addition, if you have ROS >= kinetic, please fetch the source of `nao_interaction` (master branch) for the time being ([related issue](https://github.com/ros-naoqi/nao_interaction/issues/12)).

```
cd .. # catkin_ws/src
wstool set nao_interaction --git https://github.com/ros-naoqi/nao_interaction
wstool update nao_interaction
```

Finally, please compile them.

```
cd .. # catkin_ws
catkin clean
catkin build --continue-on-failure
source devel/setup.bash
```
For some methods, they require specific branch (kochigami-develop) because they are not merged into master. [naoqi.rosinstall](https://raw.githubusercontent.com/jsk-ros-pkg/jsk_robot/master/jsk_naoqi_robot/naoqi.rosinstall) file includes this branch for `naoqi_driver`, `naoqi_bridge` and `naoqi_bridge_msgs` repositories.

## NAO & Pepper

Expand Down Expand Up @@ -245,3 +176,35 @@ To control NAO and Pepper via gazebo simulator and roseus, please refer to [here
[**_jsk_201504_miraikan_**](jsk_201504_miraikan/README.md)
- demo package which Pepper introduces themselves

## Troubleshooting

* If you use Ubuntu18.04, you need to set audio `false` in `~/catkin_ws/src/naoqi_driver/share/boot_config.json`

```
"audio":
{
"enabled" : false
},
```

* If you have the error about naoqi_dashboard, the following methods will probably work.

Install goobject
```
$ sudo apt install python-gobject-2
```

* If you connect to the robot using LAN cable, you need to set argument `network_interface` when launch `jsk_pepper_startup.launch`

```
$ roslaunch jsk_pepper_startup jsk_pepper_startup.launch network_interface:=enp0s31f6
```

* If the getting started wizard appears on Pepper's tablet, please try following methods.

`ssh nao@<Pepper's IP>` and

```
$ qicli call ALBehaviorManager.isBehaviorRunning boot-config
$ qicli call ALBehaviorManager.stopBehavior boot-config
```
Empty file.
28 changes: 28 additions & 0 deletions jsk_naoqi_robot/cross/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
TARGET_MACHINE?=i386

all:
@echo "'make system' for setup System directories"
@echo "'make user' for setup User directories"
@echo ""
@echo "By default, it compile with arm64v8(aarch64) target"
@echo "To compile with amd64 target"
@echo "run 'make system TARGET_MACHINE=amd64' or"
@echo " 'TARGET_MACHINE=amd64 ./build_ros1.sh'"

system:
./prepare_requirements_ros1.sh
./build_ros1_dependencies.sh
./build_ros1.sh

user:
./build_user.sh

install:
./install.sh

clean:
rm -fr ${TARGET_MACHINE}_ws_* Python-2.7.17 Python-2.7.17-host minizip zlib-1.2.11 pyliblzma-0.5.3

distclean: clean
rm -fr ${TARGET_MACHINE}_*

125 changes: 125 additions & 0 deletions jsk_naoqi_robot/cross/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
## Introduction

This project contains a set of patches and scripts to compile and run ROS1 on a Go1 robot, without the need of a tethered computer, based on https://github.com/esteve/ros2_pepper

## Setup Go1 Robot

### Prepare cross-compiling environment (Run only the fist time per host computer)

We're going to use Docker to set up a container that will compile all the tools for cross-compiling ROS and all of its dependencies. Go to https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-using-the-repository to install it for your Linux distribution.

1. Add your user to docker group
```
$ sudo usermod -aG docker $USER
$ newgrp
```

2. Install Qemu software
```
$ sudo apt install -y qemu-user-static
```

### Build ROS System on Docker (Run only the fist time per host computer)

```
make system
```

Caution!!! It will take more than a few hours !! So for JSK users, download the `arm64v8_System.tgz` archive file from [here](https://drive.google.com/drive/u/2/folders/1SBA9oAwjfD84yRFEB-jsCH1m5Q8eEGSK) and extract under `jsk_unitree_robot/cross/` directory before run `make` command.

Run following command to copy ROS1 base sytem to Go1 onboard computer. This should be done only in the first time. So normally user do not have to run this command
```
./install.sh -p 123 -D System
```

### Build `jsk_unitree_robot` software on Docker

You can build your current `jsk_unitree_robot` workspace on Docker environment which is ready to copy into Go1 onboard computer.

```
make user
```

To copy your software to Go1 onboard computer, run following command
```
./install.sh -p 123
```

## Detailed information

### Procedures not included in `make` process

#### Setup CUDA environment

nano3(192.168.123.15) of Pro robot does not contain CUDA environment. Please look at `pro_nano2_install_scripts` directory.

#### copy `rosdep` cache file

nano2(192.168.123.14) of Edu robot does not contain `rosdep` cache file, thus `app_manager.launch` outputs following warnings.

```
the rosdep view is empty: call 'sudo rosdep init' and 'rosdep update'
[INFO] [1631952867.412752]: Loading from plugin definitions
[WARN] [1631952867.416907]: No applist directory found.
[INFO] [1631952867.426196]: Using apps for platform 'go1'
[INFO] [1631952867.441346]: Starting app manager for robot
[INFO] [1631952867.467832]: Waiting for foreign master [http://localhost:11313] to come up...
[INFO] [1631952867.491849]: Foreign master is available
```
and you can also find find following error.
```
rospack export --lang=app_manager --attrib=app_manager jsk_unitree_startup
[rospack] Error: the rosdep view is empty: call 'sudo rosdep init' and 'rosdep update'
```

To fix this problem, go to `pro_nano2_install_scripts` directory and copy cache files.
```
cd pro_nano2_install_scripts
./copy.sh
```

#### List of software installed in Docker environment

Create List of ROS packages to be installed
```
ssh [email protected] 'source /opt/ros/melodic/setup.bash; rospack list' |tee 161-list.txt
ssh [email protected] 'source /opt/ros/melodic/setup.bash; rospack list' |tee 13-list.txt
ssh [email protected] 'source /opt/ros/melodic/setup.bash; rospack list' |tee 14-list.txt
ssh [email protected] 'source /opt/ros/melodic/setup.bash; rospack list' |tee 15-list.txt
cat 161-list.txt 13-list.txt 14-list.txt 15-list.txt | sort | uniq -c | sort | egrep "^.*4" | sed 's/^\s*4\s*\(\S*\)\s.*$/ros-melodic-\1/' | sed 's/_/-/g' | tee ros-packages.txt
```

Create List of Debian packages to be installed
```
ssh [email protected] 'dpkg --get-selections' | tee 161-select.txt
ssh [email protected] 'dpkg --get-selections' | tee 13-select.txt
ssh [email protected] 'dpkg --get-selections' | tee 14-select.txt
ssh [email protected] 'dpkg --get-selections' | tee 15-select.txt
cat 13-select.txt 14-select.txt 161-select.txt | sort | uniq -c | egrep "^\s+3\s" | sed 's/\s\s*/ /g' | cut -f 3 -d\ | sed 's/:arm64$//' | tee deb-packages.txt
```

## Known Issues

### Running python3

Since `st-000-ros1.bash` set PYTHONPATH and we installed `python-futures` via pip, It breaks python3 execution.
When you run python3, you need to unset PYTHONPATH, i.e `PYTHONPATH= vcs`

### Build time

Compile all System packages on aarch64 takes long time, It will take a whole day. You'd metter to obtain `arm64v8_System` directory from someone else.



### Development

On development phase, users are expected to develop sofoware on remote machine. All codes are expected to add in jsk_unitree_startup package.

### Deployment

You can send all development files to robot and start them on boot time.

```
make user
make install
```
Loading

0 comments on commit 25b9f6a

Please sign in to comment.