Skip to content

Commit

Permalink
ROS Standardize and update to work better with ROS standard tools (#294)
Browse files Browse the repository at this point in the history
* First pass at standardizing topics and transforms

* Updates submodules and removes diagnostics node

* Updates submodule

* Updates with ROS2 fixes

* Updates and tests with ROS

* Improves intellisense for vscode in docker and updates submodule

* Updates submodule

* Updates submodules

* Updates ROS to work with msg files in directories

* Updates ROS to work with new services

* First pass at getting quickview working

* Adds CV7-INS F9P example and computes relative position manually

* Gets ROS to build

* Adds device examples

* Moves CV7-INS with F9P example to seperate repo

* Updates readme and udev rule

* Updates udev rules and adds first pass at urdf and mesh files

* Updates models and works on urdf

* Updates submodule to allow specifying GNSS antenna offset source

* Updates submodule

* Updates submodule

* Updates examples and fixes raw imu data quaternion

* Updates submodule

* Updates submodule to rotate covariance

* Updates submodule to write reference frame to determine max number of reference frames instead of read them

* Updates submodule

* Updates submodule

* Adds detailed changelog

* Makes the examples package a catkin package

* Should remove warning from build

* Updates submodule to fix linter errors

* Updates submodule to main

---------
  • Loading branch information
robbiefish authored Jan 26, 2024
1 parent 71f12c9 commit 99f4865
Show file tree
Hide file tree
Showing 51 changed files with 2,136 additions and 432 deletions.
16 changes: 3 additions & 13 deletions .devcontainer/.vscode-docker/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"/usr/local/include/**",
"${workspaceFolder}/**",
"/opt/ros/**"
],
"defines": [
"MICROSTRAIN_ROS_VERSION=1"
],
"compilerPath": "/usr/bin/gcc",
"cStandard": "gnu17",
"cppStandard": "gnu++14",
"intelliSenseMode": "linux-gcc-x64"
"name": "CMake",
"compileCommands": "${config:cmake.buildDirectory}/compile_commands.json",
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
Expand Down
8 changes: 4 additions & 4 deletions .devcontainer/.vscode-docker/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"python.autoComplete.extraPaths": [
"/home/ros-mscl/devel/lib/python3/dist-packages",
"/opt/ros/noetic/lib/python3/dist-packages"
"/home/microstrain/catkin_ws/devel/lib/python3/dist-packages",
"/opt/ros/noetic/lib/python3/dist-packages",
],
"python.analysis.extraPaths": [
"/home/ros-mscl/devel/lib/python3/dist-packages",
"/opt/ros/noetic/lib/python3/dist-packages"
"/home/microstrain/catkin_ws/devel/lib/python3/dist-packages",
"/opt/ros/noetic/lib/python3/dist-packages",
],
"editor.tabSize": 2,
"files.associations": {
Expand Down
19 changes: 11 additions & 8 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@
"GROUP_ID": "1000"
}
},
"extensions": [
"ms-iot.vscode-ros",
"ms-vscode.cpptools",
"ms-python.python",
"ms-vscode.cmake-tools",
"ms-vscode.cpptools-extension-pack"
],
"customizations": {
"vscode": {
"extensions": [
"ms-iot.vscode-ros",
"ms-vscode.cpptools",
"ms-python.python",
"ms-vscode.cmake-tools",
"ms-vscode.cpptools-extension-pack"
],
}
},
"containerUser": "root",
"remoteUser": "microstrain",
"runArgs": [
Expand All @@ -27,7 +31,6 @@
"remoteEnv": {
"DISPLAY": "${localEnv:DISPLAY}"
},
"settings": {},
"postCreateCommand": "sudo apt-get update && rosdep install --from-paths ~/catkin_ws/src --ignore-src -r -y",
"mounts": [
"source=/dev,target=/dev,type=bind,consistency=cached",
Expand Down
31 changes: 20 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Description

Interface (driver) software, including ROS node, for the [MicroStrain](https://microstrain.com) line of inertial sensors from [Parker](http://parker.com), developed in Williston, VT.
Interface (driver) software, including ROS node, for inertial sensors from [MicroStrain by HBK](https://microstrain.com), developed in Williston, VT.

Implemented using the MicroStrain Inertial Protocol SDK ([`mip_sdk`](https://github.com/LORD-MicroStrain/mip_sdk))

Expand All @@ -11,8 +11,8 @@ Implemented using the MicroStrain Inertial Protocol SDK ([`mip_sdk`](https://git
* [Packages](#packages)
* [Install Instructions](#install-instructions)
* [Buildfarm](#buildfarm)
* [Docker](#docker)
* [Source](#source)
* [Udev Rules](#udev-rules)
* [Building From Source](#building-from-source)
* [Run Instructions](#run-instructions)
* [Single Device](#launch-the-node-and-publish-data)
Expand Down Expand Up @@ -45,7 +45,7 @@ This repo contains the following packages:

### Buildfarm

As of `v2.0.5` this package is being built and distributed by the ROS build farm. If you do not need to modify the source, it is recommended to install directly from the buildfarm by running the following commands where `ROS_DISTRO` is the version of ROS you are using such as `melodic` or `noetic`:
As of `v2.0.5` this package is being built and distributed by the ROS build farm. If you do not need to modify the source, it is recommended to install directly from the buildfarm by running the following commands where `ROS_DISTRO` is the version of ROS you are using such as `noetic`:

Driver:
```bash
Expand All @@ -60,13 +60,6 @@ sudo apt-get update && sudo apt-get install ros-ROS_DISTRO-microstrain-inertial-
For more information on the ROS distros and platforms we support, please see [index.ros.org](https://index.ros.org/r/microstrain_inertial/github-LORD-MicroStrain-microstrain_inertial/#noetic)


### Docker

As of `v2.2.2` the `microstrain_inertial_driver` is distributed as a docker image. More information on how to use the image can be found on [DockerHub](https://hub.docker.com/r/microstrain/ros-microstrain_inertial_driver).

If you are interested in working on the node in a docker container, see the [Docker Development](#docker-development) section.


### Source

If you need to modify the source of this repository, or are running on a platform that we do not support, you can build from source by following the [Building From Source](#building-from-source) guide below.
Expand Down Expand Up @@ -102,6 +95,21 @@ time you pull changes you should pull with the `--recurse-submodules` flag, or a
```
The source command will need to be run in each terminal prior to launching a ROS node.

## Udev Rules

**NOTE**: If installing from the buildfarm, the udev rules will be installed automatically

This driver comes with [udev rules](https://wiki.debian.org/udev) that will create a symlink for all microstrain devices.
To install the rules. Download the [udev](./microstrain_inertial_driver/debian/udev) file from this repo and copy it to
`/etc/udev/rules.d/100-microstrain.rules`

Once the udev rules are installed, the devices will appear as follows in the file system, where {serial} is the serial number of the device:

* `/dev/microstrain_main` - Most recent non-GQ7 device, or the main port of a GQ7 connected. **NOTE**: Do not use this rule with multiple devices as it gets overridden with multiple devices.
* `/dev/microstrain_aux` - Most recent GQ7 aux port connected. **NOTE**: Do not use this rule with multiple devices as it gets overridden with multiple devices.
* `/dev/microstrain_main_{serial}` - All non-GQ7 devices, and the main port of GQ7 devices
* `/dev/microstrain_aux_{serial}` - The aux port of GQ7 devices

## Run Instructions

#### Launch the node and publish data
Expand Down Expand Up @@ -187,6 +195,7 @@ Both the `ros` and `ros2` branches share most of their code by using git submodu

Previous versions of the driver were released as [tags](https://github.com/LORD-MicroStrain/microstrain_inertial/tags) on Github. They can also be found in specific branches:

* [`ros-3.x.x`](https://github.com/LORD-MicroStrain/microstrain_inertial/tree/ros-3.x.x) contains the most recent code before the standardizing refactor
* [`ros-2.x.x`](https://github.com/LORD-MicroStrain/microstrain_inertial/tree/ros-2.x.x) contains the most recent code before the MIP SDK refactor
* [`master`](https://github.com/LORD-MicroStrain/microstrain_inertial/tree/master) contains the most recent code before the common codebase refactor (prior to `2.0.0`)

Expand All @@ -201,4 +210,4 @@ Here is a quick overview of the licenses used in each package:
| [microstrain_inertial_driver](./microstrain_inertial_driver/LICENSE) | MIT |
| [microstrain_inertial_msgs](./microstrain_inertial_msgs/LICENSE) | MIT |
| [microstrain_inertial_rqt](./microstrain_inertial_rqt/LICENSE) | BSD |
| [microstrain_inertial_examples](./microstrain_inertial_examples/LICENSE) | MIT |
| [microstrain_inertial_examples](./microstrain_inertial_examples/LICENSE) | MIT |
44 changes: 27 additions & 17 deletions microstrain_inertial_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ project(microstrain_inertial_driver)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Export compile commands by default (helpful for clang-tidy and autocomplete for certain IDEs)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "" FORCE)

# Force some options for this module and the MIP SDK
set(BUILD_SHARED_LIBS_TEMP "${BUILD_SHARED_LIBS}")
set(BUILD_EXAMPLES_TEMP "${BUILD_EXAMPLES}")
Expand Down Expand Up @@ -67,6 +70,9 @@ else()
endif()
endif()

# Set some general CMake flags
set(CMAKE_C_FLAGS "-Wno-implicit-function-declaration -Wno-incompatible-pointer-types -Wno-unused-variable -Wno-format -fno-builtin-memcpy")

# Include the MIP SDK source
add_subdirectory("${MIP_SDK_DIR}" EXCLUDE_FROM_ALL)
include_directories("${MIP_SDK_SRC_DIR}")
Expand All @@ -80,18 +86,25 @@ find_package(catkin REQUIRED COMPONENTS
geometry_msgs
nav_msgs
nmea_msgs
mavros_msgs
rtcm_msgs
roscpp
sensor_msgs
std_msgs
std_srvs
tf2
tf2_ros
tf2_geometry_msgs
diagnostic_updater
microstrain_inertial_msgs
)

# Find some less ROS-y packages
list(APPEND CMAKE_MODULE_PATH "/usr/share/cmake/geographiclib/")
find_package(Eigen3 REQUIRED)
find_package(GeographicLib REQUIRED)

# We want to use the static library for libgeographic, but it doesn't seem to find it for us, so substitute it here
string(REGEX REPLACE "[.]so[^\\/\\s]*$" ".a" GeographicLib_LIBRARIES ${GeographicLib_LIBRARIES})

###################################
## catkin specific configuration ##
###################################
Expand All @@ -116,7 +129,7 @@ catkin_package(
sensor_msgs
nav_msgs
nmea_msgs
mavros_msgs
rtcm_msgs
message_runtime
microstrain_inertial_msgs
)
Expand All @@ -125,18 +138,21 @@ catkin_package(
###########

# Add the catkin includes
include_directories(${catkin_INCLUDE_DIRS} include ${COMMON_DIR}/include)

# Set some general CMake flags
add_definitions(-std=c++11)
set(CMAKE_C_FLAGS "-Wno-implicit-function-declaration -Wno-incompatible-pointer-types -Wno-format -fno-builtin-memcpy")
include_directories(
include
${COMMON_DIR}/include
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
${GeographicLib_INCLUDE_DIRS}
)

set(LIB_SRC_FILES
${COMMON_SRC_DIR}/subscribers.cpp
${COMMON_SRC_DIR}/publishers.cpp
${COMMON_SRC_DIR}/node_common.cpp
${COMMON_SRC_DIR}/services.cpp
${COMMON_SRC_DIR}/config.cpp
${COMMON_SRC_DIR}/utils/clock_bias_monitor.cpp

${COMMON_SRC_DIR}/utils/mappings/mip_mapping.cpp
${COMMON_SRC_DIR}/utils/mappings/mip_publisher_mapping.cpp
Expand All @@ -155,6 +171,7 @@ set(LIB_INC_FILES
${COMMON_INC_DIR}/services.h
${COMMON_INC_DIR}/config.h
${COMMON_INC_DIR}/utils/ros_compat.h
${COMMON_INC_DIR}/utils/clock_bias_monitor.h

${COMMON_INC_DIR}/utils/mappings/mip_mapping.h
${COMMON_INC_DIR}/utils/mappings/mip_publisher_mapping.h
Expand All @@ -173,20 +190,12 @@ add_dependencies(${PROJECT_NAME}
${catkin_EXPORTED_TARGETS}
)

add_library(microstrain_diagnostic_updater src/microstrain_diagnostic_updater.cpp)
add_dependencies(microstrain_diagnostic_updater
${${PROJECT_NAME}_EXPORTED_TARGETS}
${catkin_EXPORTED_TARGETS}
)

# Executables
set(NODE_SRC_FILES
src/microstrain_inertial_driver_node.cpp
src/microstrain_diagnostic_updater.cpp
)
set(NODE_INC_FILES
include/${PROJECT_NAME}/microstrain_inertial_driver.h
include/${PROJECT_NAME}/microstrain_diagnostic_updater.h
)
add_executable(${PROJECT_NAME}_node ${NODE_SRC_FILES} ${NODE_INC_FILES})

Expand Down Expand Up @@ -215,6 +224,7 @@ target_link_libraries(${PROJECT_NAME}
target_link_libraries(${PROJECT_NAME}_node
${PROJECT_NAME}
${catkin_LIBRARIES}
${GeographicLib_LIBRARIES}
)

#############
Expand All @@ -228,7 +238,7 @@ install(TARGETS ${PROJECT_NAME}_node
PUBLIC_HEADER DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)

install(DIRECTORY launch config
install(DIRECTORY launch config urdf meshes
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

Expand Down
8 changes: 4 additions & 4 deletions microstrain_inertial_driver/debian/udev
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

# Convenience rule that will register a single device to /dev/microstrain_main, /dev/microstrain_aux, or /dev/microstrain_rtk.
# This link will get continuously overridden if you have multiple devices, in which case you should use the symlinks below that will symlink by serial number
SUBSYSTEM=="tty", ATTRS{idVendor}=="199b", ATTRS{idProduct}=="3065", PROGRAM="/bin/sh -c 'echo %s{serial} | sed s/^0000__.*/rtk/g | sed s/^0000.*/main/g | sed s/^2-00.*/aux/g'", SYMLINK+="microstrain_%c", MODE="0666"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", PROGRAM="/bin/sh -c 'echo %s{serial} | sed s/^0000__.*/rtk/g | sed s/^0000.*/main/g | sed s/^2-00.*/aux/g'", SYMLINK+="microstrain_%c", MODE="0666"
SUBSYSTEM=="tty", ATTRS{idVendor}=="199b", ATTRS{idProduct}=="3065", ATTRS{manufacturer}=="Lord Microstrain", PROGRAM="/bin/sh -c 'echo %s{serial} | sed s/^0000.*/main/g | sed s/^2-00.*/aux/g | sed -e s/[[:space:]]/_/g | tr -s _'", SYMLINK+="microstrain_%c", MODE="0666"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", ATTRS{manufacturer}=="Lord Microstrain", PROGRAM="/bin/sh -c 'echo %s{serial} | sed s/^0000.*/main/g | sed s/^2-00.*/aux/g | sed -e s/[[:space:]]/_/g | tr -s _'", SYMLINK+="microstrain_%c", MODE="0666"

# Rule to create links for multiple different devices
SUBSYSTEM=="tty", ATTRS{idVendor}=="199b", ATTRS{idProduct}=="3065", PROGRAM="/bin/sh -c 'echo %s{serial} | sed s/^0000__/rtk/g | sed s/^0000/main/g | sed s/^2-00/aux/g'", SYMLINK+="microstrain_%c", MODE="0666"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", PROGRAM="/bin/sh -c 'echo %s{serial} | sed s/^0000__/rtk/g | sed s/^0000/main/g | sed s/^2-00/aux/g'", SYMLINK+="microstrain_%c", MODE="0666"
SUBSYSTEM=="tty", ATTRS{idVendor}=="199b", ATTRS{idProduct}=="3065", ATTRS{manufacturer}=="Lord Microstrain", PROGRAM="/bin/sh -c 'echo %s{serial} | sed s/^0000/main/g | sed s/^2-00/aux/g | sed -e s/[[:space:]]/_/g | tr -s _'", SYMLINK+="microstrain_%c", MODE="0666"
SUBSYSTEM=="tty", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", ATTRS{manufacturer}=="Lord Microstrain", PROGRAM="/bin/sh -c 'echo %s{serial} | sed s/^0000/main/g | sed s/^2-00/aux/g | sed -e s/[[:space:]]/_/g | tr -s _'", SYMLINK+="microstrain_%c", MODE="0666"

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Submodule microstrain_inertial_driver_common updated 33 files
+348 −307 config/params.yml
+72 −30 include/microstrain_inertial_driver_common/config.h
+97 −38 include/microstrain_inertial_driver_common/publishers.h
+18 −176 include/microstrain_inertial_driver_common/services.h
+46 −47 include/microstrain_inertial_driver_common/subscribers.h
+67 −0 include/microstrain_inertial_driver_common/utils/clock_bias_monitor.h
+44 −0 include/microstrain_inertial_driver_common/utils/geo_utils.h
+54 −46 include/microstrain_inertial_driver_common/utils/mappings/mip_publisher_mapping.h
+14 −2 include/microstrain_inertial_driver_common/utils/mip/ros_connection.h
+26 −0 include/microstrain_inertial_driver_common/utils/mip/ros_mip_device.h
+25 −0 include/microstrain_inertial_driver_common/utils/mip/ros_mip_device_main.h
+277 −367 include/microstrain_inertial_driver_common/utils/ros_compat.h
+1 −1 mip_sdk
+223 −140 src/config.cpp
+12 −6 src/node_common.cpp
+1,338 −543 src/publishers.cpp
+67 −1,656 src/services.cpp
+356 −110 src/subscribers.cpp
+69 −0 src/utils/clock_bias_monitor.cpp
+211 −147 src/utils/mappings/mip_publisher_mapping.cpp
+14 −6 src/utils/mip/ros_connection.cpp
+44 −0 src/utils/mip/ros_mip_device.cpp
+1 −1 src/utils/mip/ros_mip_device_aux.cpp
+94 −5 src/utils/mip/ros_mip_device_main.cpp
+1 −1 tools/check-wiki-publishers.sh
+36 −0 tools/check-wiki-services.sh
+36 −0 tools/check-wiki-subscribers.sh
+0 −208 wiki.txt
+11 −0 wiki/examples.txt
+205 −0 wiki/main.txt
+77 −0 wiki/relative_position_configuration.txt
+96 −0 wiki/transforms.txt
+117 −0 wiki/use_enu_frame.txt
8 changes: 4 additions & 4 deletions microstrain_inertial_driver/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
<depend>sensor_msgs</depend>
<depend>nav_msgs</depend>
<depend>nmea_msgs</depend>
<depend>mavros_msgs</depend>
<depend>rtcm_msgs</depend>
<depend>tf2_geometry_msgs</depend>

<depend>microstrain_inertial_msgs</depend>

<!-- Dependencies needed to install MSCL from the CMake file -->
<build_depend>jq</build_depend>
<build_depend>curl</build_depend>
<!-- Static or header only library deps -->
<build_depend>eigen</build_depend>
<build_depend>geographiclib</build_depend>

<build_depend>message_generation</build_depend>
<build_depend>roslint</build_depend>
Expand Down
Loading

0 comments on commit 99f4865

Please sign in to comment.