Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/ros1 ros2 snap #698

Merged

Conversation

Guillaumebeuzeboc
Copy link
Contributor

Hello,

Since the PlotJuggler snap is fairly popular, we thought about refreshing it.

These changes were done with the help of @artivis.

Goal

This PR goal is to be able to build and distribute PlotJuggler as a snap (bundling ROS & ROS 2 plugin).
There is already a PlotJuggler snap but with the PR, the GitHub Workflow will help the distributed snap to be in sync with the development.

What are the changes

  • Change in the CMakeLists:
    • The version is now set to the project
    • Config.cmake.in has been moved to a dedicated cmake/ directory
    • CMakeLists.txt install rules have been moved to the end of the file
    • Targets.cmake and Config.cmake are only installed when not compiled with catkin or colcon
    • Includes directories are now added to the target: plotjuggler_base
    • PJ_CMAKECONFIG_INSTALL_DIR has been made relative
  • The snapcraft.yaml:
    • Build zmq to be able to find it with cmake (the one available with apt cannot be found with a find_package)
    • Build PlotJuggler without ROS
    • Build ROS 1 plugin with ROS Noetic
    • Build ROS 2 plugin with ROS Foxy
      • All ROS 2 foxy messages had to be added as run-time dependency since ROS 2 plugin need to source messages to plot them
    • ROS 2 shared memory has been disabled at run-time, since strictly confined snap cannot access /dev/shm
  • GitHub Action:
    • A workflow was added to build and publish the snap from the CI
    • The workflow only publishes when on the main branch
    • Upload the snap to the candidate channel on tagged commit, edge otherwise.
      • The suggested workflow would be that the maintainer will have to move it manually to the stable channel after proper testing
    • In order to automatically upload the snap, the secret STORE_LOGIN must be defined (more details at the end)

Limitations

  • The snap doesn't support custom ROS 2 message

Since there is a lot of changes on the CMakeLists.txt I assume there could be some changes needed. Also, the GitHub Workflow publishing rules might need some adjustment.


How to set the STORE_LOGIN secret
  • Run snapcraft login with the login used for the PlotJuggler snapstore page
  • Run snapcraft export-login --snaps=plotjuggler --acls package_access,package_push,package_update,package_release exported.txt
    • Add the secret to the project by:
      • Going to the "Settings" tab
      • Choosing "Secrets" from the menu on the left, then "Actions"
      • Clicking "New repository secret".
      • Setting the name to STORE_LOGIN, and pasting the contents of exported.txt as the value.

Move in dedicated directory and check if target already exist
befire including the targets.cmake
Move install rules at the end
Export targets and cmake config but only when not compilling with ROS
Build zmq, PJ, ROS 1 and ROS 2 plugin.
Disable ROS 2 shared memory for strictly confined snap.
Add :desktop and .svg file for launcher
Publish on "candidate" when tag and edge when commit on the main branch
@facontidavide
Copy link
Owner

I am very excited about this contribution. Give me some time to review it.

@Guillaumebeuzeboc Guillaumebeuzeboc marked this pull request as ready for review July 21, 2022 14:57
facontidavide added a commit that referenced this pull request Jul 22, 2022
@facontidavide facontidavide merged commit 137316a into facontidavide:main Jul 25, 2022
@facontidavide
Copy link
Owner

I would like to add some information in the readme.

How does a user install either ROS1 or ROS2 version?

@facontidavide
Copy link
Owner

Something is not working correctly...

Staging plotjuggler 
+ snapcraftctl stage
Pulling plotjuggler-ros 
+ '[' '!' -d plotjuggler-ros-plugins ']'
+ vcs import
/bin/bash: line 37: /root/parts/plotjuggler/src/snap/local/plotjuggler.rosinstall: No such file or directory
Failed to run 'override-pull': Exit code was 1.
Build failed
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/lpbuildd/target/build_snap.py", line 206, in run
    self.pull()
  File "/usr/lib/python3/dist-packages/lpbuildd/target/build_snap.py", line 168, in pull
    self.run_build_command(
  File "/usr/lib/python3/dist-packages/lpbuildd/target/operation.py", line 46, in run_build_command
    return self.backend.run(args, cwd=cwd, env=full_env, **kwargs)
  File "/usr/lib/python3/dist-packages/lpbuildd/target/lxd.py", line 533, in run
    subprocess.check_call(cmd, **kwargs)
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['lxc', 'exec', 'lp-focal-amd64', '--env', 'LANG=C.UTF-8', '--env', 'SHELL=/bin/sh', '--env', 'http_proxy=http://10.10.10.1:8222/', '--env', 'https_proxy=http://10.10.10.1:8222/', '--env', 'GIT_PROXY_COMMAND=/usr/local/bin/lpbuildd-git-proxy', '--env', 'SNAPPY_STORE_NO_CDN=1', '--env', 'SNAPCRAFT_LOCAL_SOURCES=1', '--env', 'SNAPCRAFT_SETUP_CORE=1', '--env', 'SNAPCRAFT_BUILD_INFO=1', '--env', 'SNAPCRAFT_IMAGE_INFO={"build-request-id": "lp-72852325", "build-request-timestamp": "2022-07-25T09:17:42Z", "build_url": "https://launchpad.net/~build.snapcraft.io/+snap/ae2ea3fe098473d8b149fa6d3ba2c1b8/+build/1830878"}', '--env', 'SNAPCRAFT_BUILD_ENVIRONMENT=host', '--', '/bin/sh', '-c', 'cd /build/plotjuggler && linux64 snapcraft pull']' returned non-zero exit status 2.
Revoking proxy token...
RUN: /usr/share/launchpad-buildd/bin/in-target scan-for-processes --backend=lxd --series=focal --arch=amd64 SNAPBUILD-1830878
Scanning for processes to kill in build SNAPBUILD-1830878

@Guillaumebeuzeboc
Copy link
Contributor Author

The application

I would like to add some information in the readme.

How does a user install either ROS1 or ROS2 version?

By default, the application launched by the snap bundle both version. Hence, only selecting the correct version on the streaming menu is enough

@Guillaumebeuzeboc
Copy link
Contributor Author

Something is not working correctly...

Staging plotjuggler 
+ snapcraftctl stage
Pulling plotjuggler-ros 
+ '[' '!' -d plotjuggler-ros-plugins ']'
+ vcs import
/bin/bash: line 37: /root/parts/plotjuggler/src/snap/local/plotjuggler.rosinstall: No such file or directory
Failed to run 'override-pull': Exit code was 1.
Build failed
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/lpbuildd/target/build_snap.py", line 206, in run
    self.pull()
  File "/usr/lib/python3/dist-packages/lpbuildd/target/build_snap.py", line 168, in pull
    self.run_build_command(
  File "/usr/lib/python3/dist-packages/lpbuildd/target/operation.py", line 46, in run_build_command
    return self.backend.run(args, cwd=cwd, env=full_env, **kwargs)
  File "/usr/lib/python3/dist-packages/lpbuildd/target/lxd.py", line 533, in run
    subprocess.check_call(cmd, **kwargs)
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['lxc', 'exec', 'lp-focal-amd64', '--env', 'LANG=C.UTF-8', '--env', 'SHELL=/bin/sh', '--env', 'http_proxy=http://10.10.10.1:8222/', '--env', 'https_proxy=http://10.10.10.1:8222/', '--env', 'GIT_PROXY_COMMAND=/usr/local/bin/lpbuildd-git-proxy', '--env', 'SNAPPY_STORE_NO_CDN=1', '--env', 'SNAPCRAFT_LOCAL_SOURCES=1', '--env', 'SNAPCRAFT_SETUP_CORE=1', '--env', 'SNAPCRAFT_BUILD_INFO=1', '--env', 'SNAPCRAFT_IMAGE_INFO={"build-request-id": "lp-72852325", "build-request-timestamp": "2022-07-25T09:17:42Z", "build_url": "https://launchpad.net/~build.snapcraft.io/+snap/ae2ea3fe098473d8b149fa6d3ba2c1b8/+build/1830878"}', '--env', 'SNAPCRAFT_BUILD_ENVIRONMENT=host', '--', '/bin/sh', '-c', 'cd /build/plotjuggler && linux64 snapcraft pull']' returned non-zero exit status 2.
Revoking proxy token...
RUN: /usr/share/launchpad-buildd/bin/in-target scan-for-processes --backend=lxd --series=focal --arch=amd64 SNAPBUILD-1830878
Scanning for processes to kill in build SNAPBUILD-1830878

Is this happening from the main branch? Apparently it's missing the rosinstall file, but it's present on the main branch. This step seems to happen properly in the CI at least.
The CI failed because of a CMake location. I suspect that something went wrong with the merge of the main. I am looking into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants