diff --git a/README.md b/README.md index a9eed659..398e1408 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,15 @@ To complete `mavros` install you'll need to install `geographiclib` datasets: curl https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh | sudo bash ``` +You may optionally install udev rules to provide `/dev/px4fmu` symlink to your PX4-based flight controller connected over USB. Copy `99-px4fmu.rules` to your `/lib/udev/rules.d` folder: + +```bash +cd ~/catkin_ws/src/clever/clever/config +sudo cp 99-px4fmu.rules /lib/udev/rules.d +``` + +Alternatively you may change the `fcu_url` property in `mavros.launch` file to point to your flight controller device. + ## Running Enable systemd service `roscore` (if not running): @@ -80,6 +89,8 @@ To start connection to the flight controller, use: roslaunch clever clever.launch ``` +> Note that the package is configured to connect to `/dev/px4fmu` by default (see [previous section](#manual-installation)). Install udev rules or specify path to your FCU device in `mavros.launch`. + Also, you can enable and start the systemd service: ```bash diff --git a/builder/image-build.sh b/builder/image-build.sh index 75ff7d43..427d1e51 100755 --- a/builder/image-build.sh +++ b/builder/image-build.sh @@ -116,7 +116,7 @@ ${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/ros_pyt ${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/pigpiod.service' '/lib/systemd/system/' # ${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/kinetic-ros-clever.rosinstall' '/home/pi/ros_catkin_ws/' # Add PX4 udev rules -${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/99-px4fmu.rules' '/lib/udev/rules.d/' +${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${REPO_DIR}'/clever/config/99-px4fmu.rules' '/lib/udev/rules.d/' # Add rename script ${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/clever_rename' '/usr/local/bin/clever_rename' ${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} exec ${SCRIPTS_DIR}'/image-ros.sh' ${REPO_URL} ${IMAGE_VERSION} false false ${NUMBER_THREADS} diff --git a/clever/CMakeLists.txt b/clever/CMakeLists.txt index 04e6744c..9f245991 100644 --- a/clever/CMakeLists.txt +++ b/clever/CMakeLists.txt @@ -227,6 +227,19 @@ target_link_libraries(clever # DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} # ) +# Only install udev rules when building a Debian package +# FIXME: Other operating systems may have other prefixes +string(FIND ${CMAKE_INSTALL_PREFIX} "/opt/ros" _PREFIX_INDEX) +if (${_PREFIX_INDEX} EQUAL 0) + message(STATUS "Building as a Debian package - adding udev rules as installable files") + install(FILES + config/99-px4fmu.rules + DESTINATION /lib/udev/rules.d + ) +else() + message(STATUS "Building in a user workspace - not adding udev rules") +endif() + ############# ## Testing ## ############# diff --git a/builder/assets/99-px4fmu.rules b/clever/config/99-px4fmu.rules similarity index 100% rename from builder/assets/99-px4fmu.rules rename to clever/config/99-px4fmu.rules