mirror of
https://github.com/micro-ROS/micro-ROS-Agent.git
synced 2026-09-06 09:55:15 +02:00
Build ROS2 from source on snap (#153)
* Build ROS2 from source on snap * Update
This commit is contained in:
Vendored
+1
-1
@@ -101,4 +101,4 @@ case "$daemon" in
|
|||||||
echo "'$daemon' is not a valid boolean for daemon" >&2
|
echo "'$daemon' is not a valid boolean for daemon" >&2
|
||||||
return 1
|
return 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles" >
|
||||||
|
<transport_descriptors>
|
||||||
|
<transport_descriptor>
|
||||||
|
<transport_id>CustomUdpTransport</transport_id>
|
||||||
|
<type>UDPv4</type>
|
||||||
|
</transport_descriptor>
|
||||||
|
</transport_descriptors>
|
||||||
|
|
||||||
|
<participant profile_name="participant_profile" is_default_profile="true">
|
||||||
|
<rtps>
|
||||||
|
<userTransports>
|
||||||
|
<transport_id>CustomUdpTransport</transport_id>
|
||||||
|
</userTransports>
|
||||||
|
|
||||||
|
<useBuiltinTransports>false</useBuiltinTransports>
|
||||||
|
</rtps>
|
||||||
|
</participant>
|
||||||
|
</profiles>
|
||||||
@@ -24,4 +24,4 @@ if [ -n "$p2p_port" ]; then
|
|||||||
set -- --p2p "$p2p_port" "$@"
|
set -- --p2p "$p2p_port" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$SNAP/lib/micro_ros_agent/micro_ros_agent" "$transport" "$@"
|
exec "$SNAP/opt/ros/snap/lib/micro_ros_agent/micro_ros_agent" "$transport" "$@"
|
||||||
|
|||||||
+35
-35
@@ -71,16 +71,6 @@ description: |
|
|||||||
|
|
||||||
$ snap set micro-ros-agent device="device path"
|
$ snap set micro-ros-agent device="device path"
|
||||||
|
|
||||||
If connecting the micro-ROS Agent using an IP based connection mode,
|
|
||||||
that is, `udp4`, `udp6`, `tcp4` or `tcp6`, care must be taken to
|
|
||||||
connect first the `micro-ros-agent-shm-netplug` plug.
|
|
||||||
This is due to the fact that ROS 2 Foxy is using Fast-DDS as the
|
|
||||||
default DDS middleware, and Fast-DDS comes with *shared memory transport*.
|
|
||||||
Thus, this plugin must be enabled, in order to gain access to the
|
|
||||||
`/dev/shm` folder from the snap image, prior to running it:
|
|
||||||
|
|
||||||
$ sudo snap connect micro-ros-agent:micro-ros-agent-shm-netplug
|
|
||||||
|
|
||||||
When using the snap with a serial device, some steps need to be taken
|
When using the snap with a serial device, some steps need to be taken
|
||||||
in order to establish a successful connection:
|
in order to establish a successful connection:
|
||||||
|
|
||||||
@@ -120,49 +110,59 @@ architectures:
|
|||||||
- build-on: armhf
|
- build-on: armhf
|
||||||
- build-on: ppc64el
|
- build-on: ppc64el
|
||||||
|
|
||||||
|
package-repositories:
|
||||||
|
- components: [main]
|
||||||
|
formats: [deb]
|
||||||
|
key-id: C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
|
||||||
|
key-server: keyserver.ubuntu.com
|
||||||
|
suites: [focal]
|
||||||
|
type: apt
|
||||||
|
url: http://repo.ros2.org/ubuntu/main
|
||||||
|
|
||||||
parts:
|
parts:
|
||||||
|
ros2-foxy-extension:
|
||||||
|
build-packages: [ros-foxy-ros-core]
|
||||||
|
override-build: install -D -m 0755 launch ${SNAPCRAFT_PART_INSTALL}/snap/command-chain/ros2-launch
|
||||||
|
plugin: nil
|
||||||
|
source: $SNAPCRAFT_EXTENSIONS_DIR/ros2
|
||||||
|
|
||||||
uros-agent:
|
uros-agent:
|
||||||
plugin: colcon
|
plugin: colcon
|
||||||
source: .
|
source: .
|
||||||
override-build: |
|
colcon-cmake-args:
|
||||||
set +u
|
- -DMICROROSAGENT_SUPERBUILD=ON
|
||||||
git clone https://github.com/eProsima/Micro-XRCE-DDS-Agent.git -b $ROS_DISTRO
|
- --cmake-force-configure
|
||||||
git clone https://github.com/eProsima/Micro-CDR.git -b $ROS_DISTRO
|
override-pull: |
|
||||||
git clone https://github.com/micro-ROS/micro_ros_msgs.git -b $ROS_DISTRO
|
snapcraftctl pull
|
||||||
git clone https://github.com/micro-ROS/rosidl_typesupport_microxrcedds.git -b $ROS_DISTRO
|
|
||||||
git clone https://github.com/micro-ROS/rmw-microxrcedds.git -b $ROS_DISTRO
|
version="$(git describe --always --tags| sed -e 's/^v//;s/-/+git/;y/-/./')"
|
||||||
git clone https://github.com/micro-ROS/micro-ROS-Agent.git -b $ROS_DISTRO
|
[ -n "$(echo $version | grep "+git")" ] && grade=devel || grade=stable
|
||||||
. /opt/ros/$ROS_DISTRO/setup.sh
|
snapcraftctl set-version "$version"
|
||||||
colcon build --merge-install --install-base $SNAPCRAFT_PRIME --cmake-args "-DUAGENT_BUILD_EXECUTABLE=OFF -DUAGENT_USE_SYSTEM_FASTDDS=ON" --packages-up-to micro_ros_agent
|
snapcraftctl set-grade "$grade"
|
||||||
set -u
|
|
||||||
build-packages: [make, gcc, g++]
|
build-packages: [make, gcc, g++]
|
||||||
stage-packages: [ros-foxy-ros2launch]
|
stage-packages: [ros-foxy-ros2launch]
|
||||||
|
build-environment:
|
||||||
|
- ROS_VERSION: '2'
|
||||||
|
- ROS_DISTRO: foxy
|
||||||
|
|
||||||
runner:
|
runner:
|
||||||
plugin: dump
|
plugin: dump
|
||||||
source: snap/local/
|
source: snap/local/
|
||||||
organize:
|
organize:
|
||||||
'*': usr/bin/
|
'micro-ros-agent-daemon': usr/bin/
|
||||||
|
'fastdds_no_shared_memory.xml': usr/share/
|
||||||
plugs:
|
|
||||||
micro-ros-agent-shm-netplug:
|
|
||||||
interface: system-files
|
|
||||||
allow-auto-connection: true
|
|
||||||
write:
|
|
||||||
- /dev/shm
|
|
||||||
|
|
||||||
apps:
|
apps:
|
||||||
micro-ros-agent:
|
micro-ros-agent:
|
||||||
command: lib/micro_ros_agent/micro_ros_agent
|
command: opt/ros/snap/lib/micro_ros_agent/micro_ros_agent
|
||||||
environment:
|
environment:
|
||||||
LD_LIBRARY_PATH: "$LD_LIBRARY_PATH:$SNAP/lib"
|
FASTRTPS_DEFAULT_PROFILES_FILE: ${SNAP}/usr/share/fastdds_no_shared_memory.xml
|
||||||
plugs: [network, network-bind, serial-port, micro-ros-agent-shm-netplug]
|
plugs: [network, network-bind, serial-port]
|
||||||
extensions: [ros2-foxy]
|
|
||||||
|
|
||||||
daemon:
|
daemon:
|
||||||
command: usr/bin/micro-ros-agent-daemon
|
command: usr/bin/micro-ros-agent-daemon
|
||||||
environment:
|
environment:
|
||||||
LD_LIBRARY_PATH: "$LD_LIBRARY_PATH:$SNAP/lib"
|
FASTRTPS_DEFAULT_PROFILES_FILE: ${SNAP}/usr/share/fastdds_no_shared_memory.xml
|
||||||
daemon: simple
|
daemon: simple
|
||||||
plugs: [network, network-bind, serial-port, micro-ros-agent-shm-netplug]
|
plugs: [network, network-bind, serial-port]
|
||||||
|
|||||||
Reference in New Issue
Block a user