[README] Add comment about motion configuration setup. #191
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI of LocomanipController | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: | |
- '**' | |
schedule: | |
- cron: '0 0 * * 0' | |
jobs: | |
build-and-test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04] | |
catkin-build: [catkin, standalone] | |
build-type: [RelWithDebInfo, Debug] | |
mc-rtc-version: [head, stable] | |
motion-type: [PushCartWaypoint] | |
exclude: | |
- build-type: Debug | |
mc-rtc-version: stable | |
# Some packages have not been released onto the stable mirror yet | |
- catkin-build: standalone | |
mc-rtc-version: stable | |
include: | |
- os: ubuntu-20.04 | |
catkin-build: catkin | |
build-type: RelWithDebInfo | |
mc-rtc-version: head | |
motion-type: PushCartVelMode | |
- os: ubuntu-20.04 | |
catkin-build: standalone | |
build-type: RelWithDebInfo | |
mc-rtc-version: head | |
motion-type: PushCartVelMode | |
- os: ubuntu-20.04 | |
catkin-build: catkin | |
build-type: RelWithDebInfo | |
mc-rtc-version: head | |
motion-type: PushCartHandForce | |
- os: ubuntu-20.04 | |
catkin-build: standalone | |
build-type: RelWithDebInfo | |
mc-rtc-version: head | |
motion-type: PushCartHandForce | |
runs-on: ${{ matrix.os }} | |
env: | |
RESULTS_POSTFIX: ${{ matrix.motion-type }}-${{ matrix.catkin-build }} | |
steps: | |
- name: Setup environment variables | |
run: | | |
set -e | |
set -x | |
if [ "${{ matrix.os }}" == "ubuntu-20.04" ] && \ | |
[ "${{ matrix.build-type }}" == "RelWithDebInfo" ] && \ | |
[ "${{ matrix.mc-rtc-version }}" == "head" ] | |
then | |
echo "RUN_SIMULATION_STEPS=true" >> $GITHUB_ENV | |
else | |
echo "RUN_SIMULATION_STEPS=false" >> $GITHUB_ENV | |
fi | |
if [ "${{ matrix.os }}" == "ubuntu-20.04" ] && \ | |
[ "${{ matrix.catkin-build }}" == "catkin" ] && \ | |
[ "${{ matrix.build-type }}" == "RelWithDebInfo" ] && \ | |
[ "${{ matrix.mc-rtc-version }}" == "head" ] && \ | |
[ "${{ matrix.motion-type }}" == "PushCartWaypoint" ] && \ | |
[ "${{ github.repository_owner }}" == "isri-aist" ] && \ | |
[ "${{ github.ref }}" == "refs/heads/master" ] | |
then | |
echo "UPLOAD_DOCUMENTATION=true" >> $GITHUB_ENV | |
else | |
echo "UPLOAD_DOCUMENTATION=false" >> $GITHUB_ENV | |
fi | |
if [ "${{ matrix.catkin-build }}" == "catkin" ] | |
then | |
echo "CI_DIR=${GITHUB_WORKSPACE}/catkin_ws/src/${{ github.repository }}/.github/workflows" >> $GITHUB_ENV | |
else | |
echo "CI_DIR=${GITHUB_WORKSPACE}/.github/workflows" >> $GITHUB_ENV | |
fi | |
- name: Install dependencies | |
uses: jrl-umi3218/github-actions/install-dependencies@master | |
with: | |
ubuntu: | | |
apt-mirrors: | |
mc-rtc: | |
cloudsmith: mc-rtc/${{ matrix.mc-rtc-version }} | |
apt: libmc-rtc-dev mc-rtc-utils mc-state-observation doxygen graphviz jvrc-choreonoid choreonoid libcnoid-dev | |
ros: | | |
apt: ros-base mc-rtc-plugin eigen-conversions | |
- name: Install standalone dependencies | |
if: matrix.catkin-build == 'standalone' | |
uses: jrl-umi3218/github-actions/install-dependencies@master | |
with: | |
build-type: ${{ matrix.build-type }} | |
ubuntu: | | |
apt: libforcecontrolcollection-dev libtrajectorycollection-dev libcentroidalcontrolcollection-dev | |
github: | | |
- path: isri-aist/BaselineWalkingController | |
- path: isri-aist/CnoidRosUtils | |
- name: Checkout repository code | |
if: matrix.catkin-build == 'standalone' | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Standalone build | |
if: matrix.catkin-build == 'standalone' | |
uses: jrl-umi3218/github-actions/build-cmake-project@master | |
with: | |
build-type: ${{ matrix.build-type }} | |
- name: Catkin build | |
if: matrix.catkin-build == 'catkin' | |
uses: jrl-umi3218/github-actions/build-catkin-project@master | |
with: | |
build-type: ${{ matrix.build-type }} | |
cmake-args: -DINSTALL_DOCUMENTATION=${{ env.UPLOAD_DOCUMENTATION }} -DENABLE_QLD=ON | |
catkin-test-args: --no-deps | |
build-packages: locomanip_controller | |
test-packages: locomanip_controller | |
- name: Run simulation | |
if: env.RUN_SIMULATION_STEPS == 'true' | |
# https://github.com/jrl-umi3218/lipm_walking_controller/blob/b564d655388ae6a6725c504e5c74a62192e58c7c/.github/workflows/build.yml#L64-L92 | |
run: | | |
set -e | |
set -x | |
sudo apt-get install -y -qq xvfb ffmpeg mesa-utils fluxbox xserver-xorg xserver-xorg-core xserver-xorg-video-all libwayland-egl1-mesa | |
set +x | |
if [ "${{ matrix.catkin-build }}" == "catkin" ] | |
then | |
. ${GITHUB_WORKSPACE}/catkin_ws/devel/setup.bash | |
fi | |
set -x | |
export DISPLAY=":1" | |
Xvfb ${DISPLAY} -screen 0 1920x1080x24 & | |
sleep 10s | |
fluxbox 2> /dev/null & | |
mkdir -p ${HOME}/.config/mc_rtc/controllers | |
if [ "${{ matrix.catkin-build }}" == "catkin" ] | |
then | |
cp ${GITHUB_WORKSPACE}/catkin_ws/src/${{ github.repository }}/etc/mc_rtc.yaml ${HOME}/.config/mc_rtc | |
else | |
echo "Enabled: LocomanipController" > ${HOME}/.config/mc_rtc/mc_rtc.yaml | |
fi | |
cp ${{ env.CI_DIR }}/config/${{ matrix.motion-type }}.yaml ${HOME}/.config/mc_rtc/controllers/LocomanipController.yaml | |
ffmpeg -y -f x11grab -s 1920x1080 -r 30 -i ${DISPLAY} -qscale 0 -vcodec huffyuv /tmp/video.avi > /dev/null 2>&1 < /dev/null & | |
FFMPEG_PID=$! | |
/usr/share/hrpsys/samples/JVRC1/clear-omninames.sh | |
roscore > /dev/null 2>&1 < /dev/null & | |
ROSCORE_PID=$! | |
sleep 1s | |
if [ "${{ matrix.catkin-build }}" == "catkin" ]; then | |
roscd locomanip_controller/cnoid/project | |
else | |
cd /usr/share/hrpsys/samples/JVRC1 | |
fi | |
if [ "${{ matrix.motion-type }}" == "PushCartWaypoint" ]; then | |
CNOID_FILE=LMC_JVRC1_Cart.cnoid | |
elif [ "${{ matrix.motion-type }}" == "PushCartVelMode" ]; then | |
CNOID_FILE=LMC_JVRC1_Cart.cnoid | |
else # if [ "${{ matrix.motion-type }}" == "PushCartHandForce" ]; then | |
CNOID_FILE=LMC_JVRC1_CartHighFriction.cnoid | |
fi | |
choreonoid ${CNOID_FILE} --test-mode --start-simulation & | |
CNOID_PID=$! | |
if [ "${{ matrix.motion-type }}" == "PushCartWaypoint" ]; then | |
SLEEP_DURATION="150s" | |
elif [ "${{ matrix.motion-type }}" == "PushCartVelMode" ]; then | |
SLEEP_DURATION="100s" | |
else # if [ "${{ matrix.motion-type }}" == "PushCartHandForce" ]; then | |
SLEEP_DURATION="100s" | |
fi | |
sleep ${SLEEP_DURATION} | |
kill -2 ${ROSCORE_PID} | |
kill -2 ${CNOID_PID} | |
kill -2 ${FFMPEG_PID} | |
sleep 1s | |
kill -9 ${CNOID_PID} || true | |
sleep 10s | |
mkdir -p /tmp/results | |
ffmpeg -nostats -i /tmp/video.avi /tmp/results/LMC-video-${RESULTS_POSTFIX}.mp4 | |
LOG_FILENAME=LMC-log-${RESULTS_POSTFIX} | |
mv `readlink -f /tmp/mc-control-LocomanipController-latest.bin` /tmp/${LOG_FILENAME}.bin | |
tar czf /tmp/results/${LOG_FILENAME}.tar.gz -C /tmp ${LOG_FILENAME}.bin | |
- name: Upload simulation data | |
if: env.RUN_SIMULATION_STEPS == 'true' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: LMC-ci-results-${{ matrix.catkin-build }} | |
path: /tmp/results | |
- name: Check simulation results | |
if: env.RUN_SIMULATION_STEPS == 'true' | |
run: | | |
set -e | |
set -x | |
if [ "${{ matrix.motion-type }}" == "PushCartWaypoint" ]; then | |
EXPECTED_OBJ_POS="1.18 0.494 0.0" | |
elif [ "${{ matrix.motion-type }}" == "PushCartVelMode" ]; then | |
EXPECTED_OBJ_POS="1.33 -0.073 0.0" | |
else # if [ "${{ matrix.motion-type }}" == "PushCartHandForce" ]; then | |
EXPECTED_OBJ_POS="2.0 0.0 0.0" | |
fi | |
LOG_FILENAME=LMC-log-${RESULTS_POSTFIX} | |
python3 ${{ env.CI_DIR }}/scripts/checkSimulationResults.py /tmp/${LOG_FILENAME}.bin --expected-obj-pos ${EXPECTED_OBJ_POS} | |
- name: Upload documentation | |
if: env.UPLOAD_DOCUMENTATION == 'true' | |
run: | | |
set -e | |
set -x | |
cd ${GITHUB_WORKSPACE}/catkin_ws/src/${{ github.repository }} | |
git config --global user.name "Masaki Murooka" | |
git config --global user.email "[email protected]" | |
git remote set-url origin "https://mmurooka:${{ secrets.CI_TOKEN }}@github.com/isri-aist/LocomanipController" | |
git fetch --depth=1 origin gh-pages:gh-pages | |
git clean -dfx | |
rm -rf cmake/ | |
git checkout --quiet gh-pages | |
rm -rf doxygen/ | |
cp -r ${GITHUB_WORKSPACE}/catkin_ws/build/locomanip_controller/doc/html/ doxygen | |
git add doxygen | |
git_status=`git status -s` | |
if test -n "$git_status"; then | |
git commit --quiet -m "Update Doxygen HTML files from commit ${{ github.sha }}" | |
git push origin gh-pages | |
else | |
echo "Github pages documentation is already up-to-date." | |
fi |