Skip to content

Commit

Permalink
msg ROS2 compatibility, microdds_client improvements (timesync, reduc…
Browse files Browse the repository at this point in the history
…ed code size, added topics, etc), fastrtps purge

- update all msgs to be directly compatible with ROS2
 - microdds_client improvements
   - timesync
   - reduced code size
   - add to most default builds if we can afford it
   - lots of other little changes
 - purge fastrtps (I tried to save this multiple times, but kept hitting roadblocks)
  • Loading branch information
dagar authored Oct 19, 2022
1 parent e211e0c commit cea1852
Show file tree
Hide file tree
Showing 318 changed files with 1,943 additions and 8,934 deletions.
7 changes: 0 additions & 7 deletions .ci/Jenkinsfile-compile
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,18 @@ pipeline {
"matek_h743-slim_default",
"matek_h743_default",
"modalai_fc-v1_default",
"modalai_fc-v1_rtps",
"modalai_fc-v2_default",
"modalai_voxl2-io_default",
"mro_ctrl-zero-f7_default",
"mro_ctrl-zero-f7-oem_default",
"mro_ctrl-zero-h7-oem_default",
"mro_ctrl-zero-h7-oem_rtps",
"mro_ctrl-zero-h7_default",
"mro_ctrl-zero-h7_rtps",
"mro_pixracerpro_default",
"mro_pixracerpro_rtps",
"mro_x21-777_default",
"mro_x21_default",
"nxp_fmuk66-e_default",
"nxp_fmuk66-e_rtps",
"nxp_fmuk66-e_socketcan",
"nxp_fmuk66-v3_default",
"nxp_fmuk66-v3_rtps",
"nxp_fmuk66-v3_socketcan",
"nxp_fmurt1062-v1_default",
"nxp_ucans32k146_canbootloader",
Expand All @@ -104,7 +98,6 @@ pipeline {
"px4_fmu-v5_debug",
"px4_fmu-v5_default",
"px4_fmu-v5_lto",
"px4_fmu-v5_rtps",
"px4_fmu-v5_stackcheck",
"px4_fmu-v5_uavcanv0periph",
"px4_fmu-v5x_default",
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
"shellcheck_all",
"NO_NINJA_BUILD=1 px4_fmu-v5_default",
"NO_NINJA_BUILD=1 px4_sitl_default",
"BUILD_MICRORTPS_AGENT=1 px4_sitl_rtps",
"airframe_metadata",
"module_documentation",
"parameters_metadata",
Expand Down
34 changes: 4 additions & 30 deletions .github/workflows/metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,42 +116,16 @@ jobs:
ls -ls *
# TODO: deploy graph_px4_sitl.json to S3 px4-travis:Firmware/master/

micrortps_agent:
ROS2_msgs:
runs-on: ubuntu-latest
container: px4io/px4-dev-base-focal:2021-09-08
steps:
- uses: actions/checkout@v1
with:
token: ${{ secrets.ACCESS_TOKEN }}

- name: microRTPS agent
run: |
make px4_sitl_rtps
git clone https://github.com/PX4/micrortps_agent.git
cp -R build/px4_sitl_rtps/src/modules/micrortps_bridge/micrortps_agent/* micrortps_agent
ROS_msgs:
runs-on: ubuntu-latest
container: px4io/px4-dev-base-focal:2021-09-08
steps:
- uses: actions/checkout@v1
with:
token: ${{ secrets.ACCESS_TOKEN }}

- name: PX4 ROS msgs
- name: PX4 ROS2 msgs
run: |
git clone https://github.com/PX4/px4_msgs.git
python3 msg/tools/uorb_to_ros_msgs.py msg/ px4_msgs/msg/
ROS2_bridge:
runs-on: ubuntu-latest
container: px4io/px4-dev-base-focal:2021-09-08
steps:
- uses: actions/checkout@v1
with:
token: ${{ secrets.ACCESS_TOKEN }}

- name: PX4 ROS2 bridge
run: |
git clone https://github.com/PX4/px4_ros_com.git
./msg/tools/uorb_to_ros_urtps_topics.py -i msg/tools/urtps_bridge_topics.yaml -o px4_ros_com/templates/urtps_bridge_topics.yaml
rm px4_msgs/msg/*.msg
cp msg/*.msg px4_msgs/msg/
7 changes: 2 additions & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
path = src/drivers/gps/devices
url = https://github.com/PX4/PX4-GPSDrivers.git
branch = main
[submodule "src/modules/micrortps_bridge/micro-CDR"]
path = src/modules/micrortps_bridge/micro-CDR
url = https://github.com/PX4/Micro-CDR.git
branch = master
[submodule "platforms/nuttx/NuttX/nuttx"]
path = platforms/nuttx/NuttX/nuttx
url = https://github.com/PX4/NuttX.git
Expand Down Expand Up @@ -64,4 +60,5 @@
branch = px4
[submodule "src/modules/microdds_client/Micro-XRCE-DDS-Client"]
path = src/modules/microdds_client/Micro-XRCE-DDS-Client
url = https://github.com/eProsima/Micro-XRCE-DDS-Client.git
url = https://github.com/PX4/Micro-XRCE-DDS-Client.git
branch = px4
6 changes: 3 additions & 3 deletions .vscode/cmake-variants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ CONFIG:
buildType: RelWithDebInfo
settings:
CONFIG: px4_sitl_default
px4_sitl_rtps:
short: px4_sitl_rtps
px4_sitl_nolockstep:
short: px4_sitl_nolockstep
buildType: RelWithDebInfo
settings:
CONFIG: px4_sitl_rtps
CONFIG: px4_sitl_nolockstep
px4_sitl_asan:
short: px4_sitl (AddressSanitizer)
buildType: AddressSanitizer
Expand Down
1 change: 0 additions & 1 deletion Documentation/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,6 @@ RECURSIVE = YES
# run.

EXCLUDE = @CMAKE_SOURCE_DIR@/src/modules/uavcan/libuavcan \
@CMAKE_SOURCE_DIR@/src/modules/micrortps_bridge/micro-CDR \
@CMAKE_SOURCE_DIR@/src/examples \
@CMAKE_SOURCE_DIR@/src/templates

Expand Down
157 changes: 3 additions & 154 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,76 +13,6 @@ pipeline {
}
}
parallel {
// stage('Catkin build on ROS workspace') {
// agent {
// docker {
// image 'px4io/px4-dev-ros-melodic:2021-08-18'
// args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw -e HOME=$WORKSPACE'
// }
// }
// steps {
// sh 'ls -l'
// sh '''#!/bin/bash -l
// echo $0;
// mkdir -p catkin_ws/src;
// cd catkin_ws;
// git -C ${WORKSPACE}/catkin_ws/src/Firmware submodule update --init --recursive --force Tools/simulation/gazebo/sitl_gazebo
// git clone --recursive ${WORKSPACE}/catkin_ws/src/Firmware/Tools/simulation/gazebo/sitl_gazebo src/mavlink_sitl_gazebo;
// git -C ${WORKSPACE}/catkin_ws/src/Firmware fetch --tags;
// source /opt/ros/melodic/setup.bash;
// export PYTHONPATH=/opt/ros/$ROS_DISTRO/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages:/usr/local/lib/python2.7/dist-packages;
// catkin init;
// catkin build -j$(nproc) -l$(nproc);
// '''
// // test if the binary was correctly installed and runs using 'mavros_posix_sitl.launch'
// sh '''#!/bin/bash -l
// echo $0;
// source catkin_ws/devel/setup.bash;
// rostest px4 pub_test.launch;
// '''
// }
// post {
// always {
// sh 'rm -rf catkin_ws'
// }
// failure {
// archiveArtifacts(allowEmptyArchive: false, artifacts: '.ros/**/*.xml, .ros/**/*.log')
// }
// }
// options {
// checkoutToSubdirectory('catkin_ws/src/Firmware')
// }
// }

stage('Colcon build on ROS2 workspace') {
agent {
docker {
image 'px4io/px4-dev-ros2-foxy:2021-08-18'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw -e HOME=$WORKSPACE'
}
}
steps {
sh 'ls -l'
sh '''#!/bin/bash -l
echo $0;
unset ROS_DISTRO;
mkdir -p colcon_ws/src;
cd colcon_ws;
git -C ${WORKSPACE}/colcon_ws/src/Firmware submodule update --init --recursive --force Tools/simulation/gazebo/sitl_gazebo;
git -C ${WORKSPACE}/colcon_ws/src/Firmware fetch --tags;
source /opt/ros/foxy/setup.sh;
colcon build --event-handlers console_direct+ --symlink-install;
'''
}
post {
always {
sh 'rm -rf colcon_ws'
}
}
options {
checkoutToSubdirectory('colcon_ws/src/Firmware')
}
}

stage('Airframe') {
agent {
Expand Down Expand Up @@ -149,7 +79,7 @@ pipeline {
docker { image 'px4io/px4-dev-base-focal:2021-08-18' }
}
steps {
sh 'mkdir -p build/msg_docs; ./msg/tools/generate_msg_docs.py -d build/msg_docs'
sh 'mkdir -p build/msg_docs; ./Tools/msg/generate_msg_docs.py -d build/msg_docs'
dir('build') {
archiveArtifacts(artifacts: 'msg_docs/*.md')
stash includes: 'msg_docs/*.md', name: 'msg_documentation'
Expand Down Expand Up @@ -288,37 +218,6 @@ pipeline {
}
}

stage('microRTPS agent') {
agent {
docker { image 'px4io/px4-dev-base-focal:2021-08-18' }
}
steps {
sh('export')
sh('git fetch --all --tags')
sh('make distclean; git clean -ff -x -d .')
sh('make px4_sitl_rtps')
withCredentials([usernamePassword(credentialsId: 'px4buildbot_github_personal_token', passwordVariable: 'GIT_PASS', usernameVariable: 'GIT_USER')]) {
sh("git clone https://${GIT_USER}:${GIT_PASS}@github.com/PX4/micrortps_agent.git -b ${BRANCH_NAME}")
sh("rm -rf micrortps_agent/src micrortps_agent/idl")
sh('cp -R build/px4_sitl_rtps/src/modules/micrortps_bridge/micrortps_agent/* micrortps_agent')
sh('cd micrortps_agent; git status; git add src; git commit -a -m "Update microRTPS agent source code `date`" || true')
sh('cd micrortps_agent; git push origin ${BRANCH_NAME} || true')
sh('cd micrortps_agent; git status; git add idl; git commit -a -m "Update IDL definitions `date`" || true')
sh('cd micrortps_agent; git push origin ${BRANCH_NAME} || true')
sh('cd micrortps_agent; git status; git add CMakeLists.txt; git commit -a -m "Update CMakeLists.txt `date`" || true')
sh('cd micrortps_agent; git push origin ${BRANCH_NAME} || true')
sh('rm -rf micrortps_agent')
}
}
when {
anyOf {
branch 'main'
branch 'master' // should be removed, but in case there is something going on...
branch 'pr-jenkins' // for testing
}
}
}

stage('PX4 ROS msgs') {
agent {
docker { image 'px4io/px4-dev-base-focal:2021-08-18' }
Expand All @@ -329,66 +228,16 @@ pipeline {
withCredentials([usernamePassword(credentialsId: 'px4buildbot_github_personal_token', passwordVariable: 'GIT_PASS', usernameVariable: 'GIT_USER')]) {
sh("git clone https://${GIT_USER}:${GIT_PASS}@github.com/PX4/px4_msgs.git")
// 'main' branch
sh('./msg/tools/uorb_to_ros_msgs.py msg/ px4_msgs/msg/')
sh('rm -f px4_msgs/msg/*.msg')
sh('cp msg/*.msg px4_msgs/msg/')
sh('cd px4_msgs; git status; git add .; git commit -a -m "Update message definitions `date`" || true')
sh('cd px4_msgs; git push origin main || true')
// 'ros1' branch
sh('cd px4_msgs; git checkout ros1')
sh('./msg/tools/uorb_to_ros_msgs.py msg/ px4_msgs/msg/')
sh('cd px4_msgs; git status; git add .; git commit -a -m "Update message definitions `date`" || true')
sh('cd px4_msgs; git push origin ros1 || true')
sh('rm -rf px4_msgs')
}
}
when {
anyOf {
branch 'main'
branch 'master' // should be removed, but in case there is something going on...
branch 'pr-jenkins' // for testing
}
}
}

stage('PX4 ROS2 bridge') {
agent {
docker { image 'px4io/px4-dev-base-focal:2021-08-18' }
}
steps {
sh('export')
sh('make distclean; git clean -ff -x -d .')
withCredentials([usernamePassword(credentialsId: 'px4buildbot_github_personal_token', passwordVariable: 'GIT_PASS', usernameVariable: 'GIT_USER')]) {
sh("git clone https://${GIT_USER}:${GIT_PASS}@github.com/PX4/px4_ros_com.git -b ${BRANCH_NAME}")
// deploy uORB RTPS ID map
sh('./msg/tools/uorb_to_ros_urtps_topics.py -i msg/tools/urtps_bridge_topics.yaml -o px4_ros_com/templates/urtps_bridge_topics.yaml')
sh('cd px4_ros_com; git status; git add .; git commit -a -m "Update uORB RTPS ID map `date`" || true')
sh('cd px4_ros_com; git push origin ${BRANCH_NAME} || true')
// deploy uORB RTPS required tools
sh('cp msg/tools/uorb_rtps_classifier.py px4_ros_com/scripts/uorb_rtps_classifier.py')
sh('cp msg/tools/generate_microRTPS_bridge.py px4_ros_com/scripts/generate_microRTPS_bridge.py')
sh('cp msg/tools/px_generate_uorb_topic_files.py px4_ros_com/scripts/px_generate_uorb_topic_files.py')
sh('cp msg/tools/px_generate_uorb_topic_helper.py px4_ros_com/scripts/px_generate_uorb_topic_helper.py')
// deploy templates
sh('cp msg/templates/urtps/microRTPS_agent.cpp.em px4_ros_com/templates/microRTPS_agent.cpp.em')
sh('cp msg/templates/urtps/microRTPS_timesync.cpp.em px4_ros_com/templates/microRTPS_timesync.cpp.em')
sh('cp msg/templates/urtps/microRTPS_timesync.h.em px4_ros_com/templates/microRTPS_timesync.h.em')
sh('cp msg/templates/urtps/microRTPS_transport.cpp px4_ros_com/templates/microRTPS_transport.cpp')
sh('cp msg/templates/urtps/microRTPS_transport.h px4_ros_com/templates/microRTPS_transport.h')
sh('cp msg/templates/urtps/Publisher.cpp.em px4_ros_com/templates/Publisher.cpp.em')
sh('cp msg/templates/urtps/Publisher.h.em px4_ros_com/templates/Publisher.h.em')
sh('cp msg/templates/urtps/Subscriber.cpp.em px4_ros_com/templates/Subscriber.cpp.em')
sh('cp msg/templates/urtps/Subscriber.h.em px4_ros_com/templates/Subscriber.h.em')
sh('cp msg/templates/urtps/RtpsTopics.cpp.em px4_ros_com/templates/RtpsTopics.cpp.em')
sh('cp msg/templates/urtps/RtpsTopics.h.em px4_ros_com/templates/RtpsTopics.h.em')
sh('cd px4_ros_com; git status; git add .; git commit -a -m "Update uORB RTPS script tools `date`" || true')
sh('cd px4_ros_com; git push origin ${BRANCH_NAME} || true')
sh('rm -rf px4_msgs')
}
}
when {
anyOf {
branch 'main'
branch 'master' // should be removed, but in case there is something going on...
branch 'pr-jenkins' // for testing
}
}
}
Expand Down
21 changes: 5 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,6 @@ ifdef PYTHON_EXECUTABLE
override CMAKE_ARGS += -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
endif

# Check if the microRTPS agent is to be built
ifdef BUILD_MICRORTPS_AGENT
override CMAKE_ARGS += -DBUILD_MICRORTPS_AGENT=ON
endif

# Functions
# --------------------------------------------------------------------
# describe how to build a cmake config
Expand Down Expand Up @@ -253,7 +248,7 @@ endef
# Other targets
# --------------------------------------------------------------------

.PHONY: qgc_firmware px4fmu_firmware misc_qgc_extra_firmware check_rtps
.PHONY: qgc_firmware px4fmu_firmware misc_qgc_extra_firmware

# QGroundControl flashable NuttX firmware
qgc_firmware: px4fmu_firmware misc_qgc_extra_firmware
Expand All @@ -278,15 +273,7 @@ misc_qgc_extra_firmware: \
check_airmind_mindpx-v2_default \
sizes

# builds with RTPS
check_rtps: \
check_px4_fmu-v3_rtps \
check_px4_fmu-v4_rtps \
check_px4_fmu-v4pro_rtps \
check_px4_sitl_rtps \
sizes

.PHONY: sizes check quick_check check_rtps uorb_graphs
.PHONY: sizes check quick_check uorb_graphs

sizes:
@-find build -name *.elf -type f | xargs size 2> /dev/null || :
Expand Down Expand Up @@ -495,7 +482,9 @@ shellcheck_all:

validate_module_configs:
@find "$(SRC_DIR)"/src/modules "$(SRC_DIR)"/src/drivers "$(SRC_DIR)"/src/lib -name *.yaml -type f \
-not -path "$(SRC_DIR)/src/lib/mixer_module/*" -not -path "$(SRC_DIR)/src/lib/crypto/libtommath/*" -print0 | \
-not -path "$(SRC_DIR)/src/lib/mixer_module/*" \
-not -path "$(SRC_DIR)/src/modules/microdds_client/dds_topics.yaml" \
-not -path "$(SRC_DIR)/src/lib/crypto/libtommath/*" -print0 | \
xargs -0 "$(SRC_DIR)"/Tools/validate_yaml.py --schema-file "$(SRC_DIR)"/validation/module_schema.yaml

# Cleanup
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ The PX4 Dev Team syncs up on a [weekly dev call](https://docs.px4.io/main/en/con
* [Paul Riseborough](https://github.com/priseborough)
* Vision based navigation and Obstacle Avoidance
* [Markus Achtelik](https://github.com/markusachtelik)
* RTPS/ROS2 Interface
* DDS/ROS2 Interface
* [Nuno Marques](https://github.com/TSC21)

See also [maintainers list](https://px4.io/community/maintainers/) (px4.io) and the [contributors list](https://github.com/PX4/PX4-Autopilot/graphs/contributors) (Github).
Expand Down
1 change: 0 additions & 1 deletion ROMFS/px4fmu_common/init.d-posix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ add_subdirectory(airframes)
px4_add_romfs_files(
px4-rc.mavlink
px4-rc.params
px4-rc.rtps
px4-rc.simulator
rc.replay
rcS
Expand Down
4 changes: 0 additions & 4 deletions ROMFS/px4fmu_common/init.d-posix/px4-rc.rtps

This file was deleted.

Loading

0 comments on commit cea1852

Please sign in to comment.