Skip to content

Commit

Permalink
Merge remote-tracking branch 'knorth55/tweet-volume-control' into dev…
Browse files Browse the repository at this point in the history
…elop/fetch-tweet-volume-control
  • Loading branch information
knorth55 committed Nov 18, 2022
2 parents 6999484 + 005ce8b commit 1b7c2a2
Show file tree
Hide file tree
Showing 20 changed files with 441 additions and 194 deletions.
14 changes: 14 additions & 0 deletions jsk_fetch_robot/fetcheus/fetch-interface.l
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@
(ros::load-ros-package "fetch_driver_msgs")
(ros::load-ros-package "robot_controllers_msgs")

(when (null (assoc :delete-object-by-id (send collision-object-publisher :methods)))
(ros::ros-warn ";;")
(ros::ros-warn ";;")
(ros::ros-warn ";; jsk-ros-pkg/jsk_pr2eus <0.3.14 does not have :delete-object-by-id method")
(ros::ros-warn ";; If you need full features of latest fetcheus, please use jsk_pr2eus from source")
(ros::ros-warn ";; See https://github.com/jsk-ros-pkg/jsk_demos/pull/1375#issuecomment-1292943531")
(ros::ros-warn ";;")
(ros::ros-warn ";;")
(defmethod collision-object-publisher
(:delete-attached-object-by-id (object-id)
(ros::ros-warn ";; did not delete attached object \"~A\"" object-id))
(:delete-object-by-id (object-id)
(ros::ros-warn ";; did not delete object \"~A\"" object-id))))

(defclass fetch-interface
:super robot-move-base-interface
:slots (gripper-action moveit-robot fetch-controller-action point-head-action)
Expand Down
117 changes: 56 additions & 61 deletions jsk_naoqi_robot/cross/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## 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
This project contains a set of patches and scripts to compile and run ROS1 on a Pepper robot, without the need of a tethered computer, based on https://github.com/esteve/ros2_pepper and https://github.com/jsk-ros-pkg/jsk_robot/blob/master/jsk_unitree_robot/cross/README.md

## Setup Go1 Robot
## Setup Pepper Robot

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

Expand All @@ -19,107 +19,102 @@ $ newgrp
$ sudo apt install -y qemu-user-static
```

### Build ROS System on Docker (Run only the fist time per host computer)
3. Install Aldebaran's cross environment tool-chains

```
make system
```
Download and extract ctc-linux64-atom-2.5.10.7.zip (use [GoogleDrive](https://drive.google.com/drive/folders/1P49oBEobwyVI4TG1nxxXUftc9TLEYEc7) for JSK Users) in your home directory.

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.
Set environment variable to your `.bashrc`

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
export ALDE_CTC_CROSS=$HOME/ctc-linux64-atom-2.5.10.7
```

### 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.
4. Install command used in scripts

```
make user
apt install python-vcstool sshpass
```

To copy your software to Go1 onboard computer, run following command
### Build ROS System on Docker (Run only the fist time per host computer)

```
./install.sh -p 123
make system
```

## Detailed information

### Procedures not included in `make` process
Caution!!! It will take more than a few hours !!

#### Setup CUDA environment

nano3(192.168.123.15) of Pro robot does not contain CUDA environment. Please look at `pro_nano2_install_scripts` directory.
Run following command to copy ROS1 base sytem to Pepper onboard computer. This should be done only in the first time. So normally user do not have to run this command. You need to specify password by -p option.
```
./install.sh -p <robot password> -d System
```

#### copy `rosdep` cache file
### Build `jsk_pepper_robot` software on Docker

nano2(192.168.123.14) of Edu robot does not contain `rosdep` cache file, thus `app_manager.launch` outputs following warnings.
You can build your current `jsk_pepper_robot` workspace on Docker environment which is ready to copy into Pepper onboard computer.

```
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'
make user
```

To fix this problem, go to `pro_nano2_install_scripts` directory and copy cache files.
To copy your software to Pepper onboard computer, run following command
```
cd pro_nano2_install_scripts
./copy.sh
./install.sh -p <robot password>
```

#### List of software installed in Docker environment
## Start `jsk_pepper_startup.launch`

Create List of ROS packages to be installed
ssh to NAO_IP machine and run
```
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
source User/user_setup.bash
roslaunch --screen jsk_pepper_startup jsk_pepper_startup.launch network_interface:=eth0 launch_dashboard:=false launch_joy:=false
```

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
```
You can connect to `app_chooser` by http://<$NAO_IP>:8000/rwt_app_chooser/#!robot

## Known Issues

### Running python3
### `./install.sh -d System` errors at the first time.

./install.sh -d System` requires `User` environment, so it causes error at the first time. You need to re-run `./install.sh` after you installed User space.

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_user.sh build -c` fails

### Build time
`./build_user.sh build -c` fails as follows. This is expected behavior and we recommend to combile all packages in the first time. `make user` runs `catkin build jsk_pepper_startup peppereus` and pacakages such as `pepepr_meshes` and `rosbash` is not compiled with this command.

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.
```
[ Failed] roseus_remote
[ Failed] speak_and_wait_recovery
```

### To comple `pepper.l` within the robot

```
cp -r /opt/ros/melodic/share/pepper_meshes/meshes/ ./i386_User/src/pepper_meshes/
rm -fr i386_User/build/pepper_meshes/ i386_User/build/peppereus
./build_user.sh build pepper_meshes peppereus
```

### Development

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

### Deployment

You can send all development files to robot and start them on boot time.
You can send all development files to robot and start them on boot time. Note that this process requres `NAO_IP` environment variable.

```
make user
make install
```

If you want to use ethernet, you need to change from `wlan0` to `eth0` in `jsk_naoqi_robot/cross/startup_scripts/user_setup.bash` and run `make install`
```
export ROS_IP=$(ip addr show eth0 | grep -Po '(?<= inet )([0-9]{1,3}.){3}[0-9]{1,3}')
```

If you add more dependencies to `package.xml`, you need to remove `i386_Users` and run `make user` again.


You can restore from saved docker container. For JSK users, you can find latest data at [Google Drive](https://drive.google.com/drive/u/1/folders/10rINVGt1iDM2WNofmf0sZBX_iTnpXya6). You can also find backup of `i386_System`.
```
docker load < ros1-pepper.tar
```
19 changes: 16 additions & 3 deletions jsk_naoqi_robot/cross/build_user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ PYTHON2_VERSION=2.7.17

TARGET_ROBOT="${TARGET_ROBOT:-pepper}"

ARGS="${@:-build jsk_${TARGET_ROBOT}_startup ${TARGET_ROBOT}eus}"
ARGS="${@:-build rosbash ${TARGET_ROBOT}_meshes jsk_${TARGET_ROBOT}_startup ${TARGET_ROBOT}eus}" # peppereus requres pepper_meshes

set -euf -o pipefail

Expand All @@ -29,7 +29,7 @@ fi
set -x
# copy jsk_robot direcotry to jsk_catkin_ws/src
mkdir -p ${SOURCE_ROOT}/src/jsk_robot
rsync -avzh --delete --exclude 'jsk_naoqi_robot/cross*' --exclude "nao.l" --exclude "pepper.l" ../../../jsk_robot ${SOURCE_ROOT}/src/
rsync -avzh --delete --exclude 'jsk_naoqi_robot/cross*' --exclude "nao.l" --exclude "pepper.l" --exclude "nao-simple.l" --exclude "pepper-simple.l" ../../../jsk_robot ${SOURCE_ROOT}/src/

# ingore non-related packages
for dir in $(find ${SOURCE_ROOT}/src/jsk_robot -maxdepth 1 -mindepth 1 -type d); do
Expand All @@ -41,6 +41,17 @@ done
# add unitree repos
[ ${UPDATE_SOURCE_ROOT} -eq 0 ] || vcs import ${SOURCE_ROOT}/src < repos/pepper.repos

# force copy pepper_meshes
if [ ! -e ${SOURCE_ROOT}/src/pepper_meshes/meshes ]; then
if [ ! -e /opt/ros/melodic/share/pepper_meshes/meshes/ ]; then
set +x
echo "ERROR: You need /opt/ros/melodic/share/pepper_meshes/meshes/ " 1>&2
echo "ERROR: run apt 'install ros-melodic-pepper-meshes'" 1>&2
exit -1
fi
cp -r /opt/ros/melodic/share/pepper_meshes/meshes/ ${SOURCE_ROOT}/src/pepper_meshes/
fi

## UPDATE_SOURCE_ROOT=1 # TRUE

# run on docker
Expand Down Expand Up @@ -74,7 +85,9 @@ docker run -it --rm \
-DPYTHON_LIBRARY=/home/nao/System/Python-2.7.17/lib/libpython2.7.so \
--cmake-args -DCATKIN_ENABLE_TESTING=FALSE --make-args VERBOSE=1\
" 2>&1 | tee ${TARGET_MACHINE}_build_user.log
cp ${PWD}/startup_scripts/user_setup.bash ${SOURCE_ROOT}/
cp -a ${PWD}/startup_scripts/user_setup.bash ${SOURCE_ROOT}/
cp -a ${PWD}/startup_scripts/start.sh ${SOURCE_ROOT}/
cp -a ${PWD}/startup_scripts/screenrc ${SOURCE_ROOT}/

echo "
Expand Down
5 changes: 3 additions & 2 deletions jsk_naoqi_robot/cross/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,12 @@ function copy_data () {

if [[ "${TARGET_DIRECTORY}" == "System" ]]; then
sed -i 's@if 0:@if 1:@' i386_System/Python-2.7.17/lib/python2.7/site-packages/rosdep2/sources_list.py
sshpass -p $PASS ssh -t ${user}@${hostname} bash -x -c 'test -e .ros/rosdep/sources.cache/index && exit 0; source User/user_setup.bash; export ROS_ETC_DIR=User/etc; rosdep init; rosdep update'
fi

if [[ "${TARGET_DIRECTORY}" == "User" ]]; then
sshpass -p $PASS ssh -t ${user}@${hostname} bash -c 'mkdir -p .local/share/PackageManager/apps/img/html/; cp -r User/src/jsk_robot/jsk_naoqi_robot/jsk_pepper_startup/apps/meeting/image/* .local/share/PackageManager/apps/img/html/'
## add ls; then run your command ???? https://stackoverflow.com/a/33107011
sshpass -p $PASS ssh -t ${user}@${hostname} bash -c 'ls; test -e .ros/rosdep/sources.cache/index && exit 0; echo "OK"; source User/user_setup.bash; export ROS_ETC_DIR=User/etc; rosdep init; rosdep update'
sshpass -p $PASS ssh -t ${user}@${hostname} bash -c 'ls; mkdir -p .local/share/PackageManager/apps/img/html/; cp -r User/src/jsk_robot/jsk_naoqi_robot/jsk_pepper_startup/apps/meeting/image/* .local/share/PackageManager/apps/img/html/'
fi
}

Expand Down
4 changes: 2 additions & 2 deletions jsk_naoqi_robot/cross/prepare_requirements_ros1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ docker run -it --rm \
pip install cython==0.26.1 && \
pip install PyYaml==3.12 Pillow==5.1.0 empy==3.3.2 docutils==0.14 pyparsing==2.2.0 python-dateutil==2.6.1 six==1.11.0 setuptools==39.0.1 numpy==1.13.3 defusedxml==0.5.0 netifaces==0.10.4 pymongo==3.6.1 image tornado==4.5.3 && \
pip install catkin-pkg==0.5.2 rospkg==1.4.0 catkin-tools==0.6.1 && \
pip install service-identity==16.0.0 pyasn1==0.4.2 pyasn1-modules==0.2.1 && \
pip install pyOpenSSL==17.5.0 cryptography==2.1.4 service-identity==16.0.0 pyasn1==0.4.2 pyasn1-modules==0.2.1 && \
pip install pycryptodomex==3.4.7 && \
\
echo ';; Install Twisted' && \
Expand All @@ -147,7 +147,7 @@ docker run -it --rm \
wget https://files.pythonhosted.org/packages/93/ba/83fe91c2f6c613d53ce65d89b50620fc760d698a2f66b6b80147118a5c0f/Twisted-16.0.0.tar.bz2 && \
tar -xjvf Twisted-16.0.0.tar.bz2 && \
cd Twisted-16.0.0 && \
python setup.py install
python setup.py install && \
\
echo ';; Install rosinstall_generator' && \
\
Expand Down
17 changes: 16 additions & 1 deletion jsk_naoqi_robot/cross/repos/ros1_dependencies.repos
Original file line number Diff line number Diff line change
Expand Up @@ -317,4 +317,19 @@ repositories:
url: http://archive.ubuntu.com/ubuntu/pool/main/g/gpgme1.0/gpgme1.0_1.10.0.orig.tar.bz2
libgpgme-dev/debian:
type: tar
url: http://archive.ubuntu.com/ubuntu/pool/main/g/gpgme1.0/gpgme1.0_1.10.0-1ubuntu2.debian.tar.xz
url: http://archive.ubuntu.com/ubuntu/pool/main/g/gpgme1.0/gpgme1.0_1.10.0-1ubuntu2.debian.tar.xz
screen:
type: tar
url: http://archive.ubuntu.com/ubuntu/pool/main/s/screen/screen_4.6.2.orig.tar.gz
screen/debian:
type: tar
url: http://archive.ubuntu.com/ubuntu/pool/main/s/screen/screen_4.6.2-1.debian.tar.xz
libogg-dev:
type: tar
url: http://archive.ubuntu.com/ubuntu/pool/main/libo/libogg/libogg_1.3.2.orig.tar.gz
libtheora:
type: tar
url: http://archive.ubuntu.com/ubuntu/pool/main/libt/libtheora/libtheora_1.1.1+dfsg.1.orig.tar.gz
libtheora/debian:
type: tar
url: http://archive.ubuntu.com/ubuntu/pool/main/libt/libtheora/libtheora_1.1.1+dfsg.1-14.debian.tar.xz
25 changes: 25 additions & 0 deletions jsk_naoqi_robot/cross/ros1_dependencies_build_scripts/1044-screen
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
set -xeuf -o pipefail

DEBIAN_DIR=/home/nao/ros1_dependencies_sources/src/screen/debian/debian
SOURCE_DIR=/home/nao/ros1_dependencies_sources/src/screen/screen-4.6.2

cd ${DEBIAN_DIR}/patches
if [ ! -e .patched ]; then
for patch_file in $(cat series); do
[ -e "${patch_file}" ] || continue
OUT="$(patch -p1 --forward --directory ${SOURCE_DIR} < ${patch_file} | tee /dev/tty)" || echo "${OUT}" | grep "Skipping patch" -q || (echo "$OUT" && false)
done
touch .patched
fi

cd ${SOURCE_DIR}

#LIBNCURSES_LIBS="-lncurses -ltinfo" LIBNCURSES_CFLAGS="-I/home/nao/System/ros1_dependencies/include/ncurses -D_GNU_SOURCE -D_DEFAULT_SOURCE"
./configure \
--prefix=/home/nao/${INSTALL_ROOT}/ros1_dependencies \
--enable-static --host=i686-aldebaran-linux-gnu \
--disable-pam --disable--socket-dir --disable-doc

make -j4 install
# make install --list-missing -X.la -Xinfo/dir -X.pyc -Xinstall_files.txt -X__pycache__
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -xeuf -o pipefail

DEBIAN_DIR=/home/nao/ros1_dependencies_sources/src/libogg-dev/debian/debian
SOURCE_DIR=/home/nao/ros1_dependencies_sources/src/libogg-dev/libogg-1.3.2

# cd ${DEBIAN_DIR}/patches
# if [ ! -e .patched ]; then
# for patch_file in $(cat series); do
# [ -e "${patch_file}" ] || continue
# OUT="$(patch -p1 --forward --directory ${SOURCE_DIR} < ${patch_file} | tee /dev/tty)" || echo "${OUT}" | grep "Skipping patch" -q || (echo "$OUT" && false)
# done
# touch .patched
# fi

cd ${SOURCE_DIR}

./configure \
--prefix=/home/nao/${INSTALL_ROOT}/ros1_dependencies \
--enable-static --host=i686-aldebaran-linux-gnu

make clean || echo "OK"
make -j4 install
# make install --list-missing -X.la -Xinfo/dir -X.pyc -Xinstall_files.txt -X__pycache__
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -xeuf -o pipefail

DEBIAN_DIR=/home/nao/ros1_dependencies_sources/src/libtheora/debian/debian
SOURCE_DIR=/home/nao/ros1_dependencies_sources/src/libtheora/libtheora-1.1.1

cd ${DEBIAN_DIR}/patches
if [ ! -e .patched ]; then
for patch_file in $(cat series); do
[ -e "${patch_file}" ] || continue
OUT="$(patch -p1 --forward --directory ${SOURCE_DIR} < ${patch_file} | tee /dev/tty)" || echo "${OUT}" | grep "Skipping patch" -q || (echo "$OUT" && false)
done
touch .patched
fi

cd ${SOURCE_DIR}

./configure \
--prefix=/home/nao/${INSTALL_ROOT}/ros1_dependencies \
--enable-static --host=i686-aldebaran-linux-gnu

make -j4 install-exec
make -j4 install-pkgconfigDATA
# make install --list-missing -X.la -Xinfo/dir -X.pyc -Xinstall_files.txt -X__pycache__
2 changes: 2 additions & 0 deletions jsk_naoqi_robot/cross/startup_scripts/screenrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
escape ^Tt
hardstatus alwayslastline "%H %-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"
9 changes: 9 additions & 0 deletions jsk_naoqi_robot/cross/startup_scripts/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

set -xef -o pipefail

source User/user_setup.bash
screen -c User/screenrc -dmS session bash
screen -c User/screenrc -S session -p 0 -X stuff "roslaunch jsk_pepper_startup jsk_pepper_startup.launch launch_dashboard:=false network_interface:=wlan0 launch_joy:=false^M"
sleep 1 # wait for screen to startup
screen -c User/screenrc -r
1 change: 1 addition & 0 deletions jsk_naoqi_robot/jsk_pepper_startup/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<run_depend>std_msgs</run_depend>
<run_depend>std_srvs</run_depend>
<run_depend>teleop_twist_joy</run_depend>
<run_depend>compressed_image_transport</run_depend>
<run_depend>jsk_robot_startup</run_depend>
<run_depend>rwt_app_chooser</run_depend>
<run_depend>app_manager</run_depend>
Expand Down
Loading

0 comments on commit 1b7c2a2

Please sign in to comment.