Skip to content

Commit

Permalink
Update Galactic branch with Gitlab files
Browse files Browse the repository at this point in the history
  • Loading branch information
M-slibi committed Mar 1, 2022
1 parent c619d11 commit 9e57d02
Show file tree
Hide file tree
Showing 13 changed files with 120 additions and 80 deletions.
53 changes: 0 additions & 53 deletions .gitlab-ci.yml

This file was deleted.

10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The following VS Code `tasks.json` file was used:
{
"type": "shell",
"label": "colcon build",
"args":["source /opt/ros/foxy/setup.bash && cd ~/code/ros2_ws/ && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Debug && . install/setup.bash"],
"args":["source /opt/ros/galactic/setup.bash && cd ~/code/ros2_ws/ && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Debug && . install/setup.bash"],
},
]
}
Expand Down Expand Up @@ -60,7 +60,7 @@ This project is split into numerous modules, each in their own directory:
A list of ROS topics published by this driver can be found in [the README](./README.md).

### Releases
* Release versions of this driver reside in branches corresponding to the distribution of ROS they are designed for use with, e.g. `foxy` or `eloquent`.
* Release versions of this driver reside in branches corresponding to the distribution of ROS they are designed for use with, e.g. `galactic` or `eloquent`.
* Branches which are under development, and in the progress of updating the code for use with a new distribution of ROS, are suffixed with `-devel`, e.g. `galactic-devel`.
* The `master` branch contains a release for the latest distribution of ROS.
* The ROS driver uses [semantic versioning](https://semver.org/) for its version number.
Expand Down Expand Up @@ -112,7 +112,7 @@ Building the test program requires something like:

```bash
# In the root directory of the compiled package, e.g. ~/ros_ws/
. /opt/ros/foxy/setup.bash
. /opt/ros/galactic/setup.bash
. install/setup.sh
colcon build
```
Expand All @@ -131,9 +131,9 @@ This driver uses the `Boost.Test` framework for its unit tests. Each file in the
Documentation on this unit testing framework, including an API reference and user's guide, can be found [here](https://www.boost.org/doc/libs/1_77_0/libs/test/doc/html/index.html).

## Learning ROS 2
See the following short tutorials for a quality introduction to package development for ROS 2 (Foxy Fitzroy):
See the following short tutorials for a quality introduction to package development for ROS 2 (Galactic Geochelone):

- [Installation](https://index.ros.org/doc/ros2/Installation/Foxy/Linux-Install-Debians/).
- [Installation](https://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html).
- [Create a workspace](https://index.ros.org/doc/ros2/Tutorials/Workspace/Creating-A-Workspace/).
- [Create your first package](https://index.ros.org/doc/ros2/Tutorials/Creating-Your-First-ROS2-Package/).
- [Create a simple publisher/subscriber pair](https://index.ros.org/doc/ros2/Tutorials/Writing-A-Simple-Cpp-Publisher-And-Subscriber/#cpppubsub).
Expand Down
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# ROS2 Driver

[![Pipeline_Status](https://gitlab.com/oxts/navigation/ros/oxts/badges/Galactic/pipeline.svg)](https://gitlab.com/oxts/navigation/ros/oxts/-/commits/Galactic)

A ROS2 driver which allows an OxTS INS to interact with a wider ROS network. Where ROS is mentioned in this document, this is in reference to ROS2. References to ROS1 will be explicit.

The ROS driver has been built with ROS release Foxy Fitzroy.
The ROS driver has been built with ROS release Galactic Geochelone.

## Build from source

Dependencies:

- ROS2 (Foxy Fitzroy). (See [here](https://index.ros.org/doc/ros2/Installation/Foxy/Linux-Install-Debians/) for an installation guide.)
- ROS2 (Galactic Geochelone). (See [here](https://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html) for an installation guide.)

```bash
sudo apt install doxygen
Expand All @@ -18,7 +20,7 @@ pip3 install sphinx breathe sphinx_rtd_theme
To build the driver:

```bash
. /opt/ros/foxy/setup.bash # "." and "source" are interchangeable (unix)
. /opt/ros/galactic/setup.bash # "." and "source" are interchangeable (unix)
mkdir -p ros_ws/src
cd ros_ws/src
git clone https://github.com/OxfordTechnicalSolutions/oxts_ros2_driver
Expand Down Expand Up @@ -55,6 +57,14 @@ The currently available launch files are as follows:
* `visualise.py` - Launches the driver, as well as `robot_state_publisher` and `rviz2` (the latter can be disabled with `use_rviz:=False`)
* `run.py` - Only launches the driver, without `robot_state_publisher` and no `use_rviz` option

You can also override options from the configuration file at the command-line, e.g.:

```bash
ros2 launch oxts run.py topic_prefix:=myprefix
```

**Be aware that currently, this only works for some options.**

## Getting started
For a basic tutorial on using this driver, see the ["getting started" guide](./Getting%20Started.md).

Expand Down Expand Up @@ -87,7 +97,7 @@ The publisher node included in this driver opens a socket to receive NCOM messag
* **ins/velocity** [geometry_msgs/msg/TwistStamped](http://docs.ros.org/en/noetic/api/geometry_msgs/html/msg/TwistStamped.html)
Velocity of the INS, in the INS frame. (Linear velocity corresponds to measurements `IsoVoX`, `IsoVoY` and `IsoVoZ`, while angular velocity is `Wx`, `Wy` and `Wz`.)

* **ins/odometry** [nav_msgs/msg/Odometry](https://github.com/ros2/common_interfaces/blob/foxy/nav_msgs/msg/Odometry.msg)
* **ins/odometry** [nav_msgs/msg/Odometry](https://github.com/ros2/common_interfaces/blob/galactic/nav_msgs/msg/Odometry.msg)
Odometry data from the INS.
- Position: In a local reference frame which, depending on your configuration, is defined either by:
- The LRF in NCom (`RefLat`, `RefLon`, `RefAlt` and `RefHeading`).
Expand All @@ -97,7 +107,7 @@ The publisher node included in this driver opens a socket to receive NCOM messag
- Linear Velocity: In the above reference frame, computed from `IsoVoX`, `IsoVoY` and `IsoVoZ`. (Does not yet have variances.)
- Angular Velocity: In the above reference frame, computed from `Wx`, `Wy` and `Wz`. (Does not yet have variances.)

* **ins/path** [nav_msgs/msg/Path](https://github.com/ros2/common_interfaces/blob/foxy/nav_msgs/msg/Path.msg)
* **ins/path** [nav_msgs/msg/Path](https://github.com/ros2/common_interfaces/blob/galactic/nav_msgs/msg/Path.msg)
Path taken by the INS, this path contains all historical positions and orientations from the **ins/odometry** topic.

* **ins/time_reference** [sensor_msgs/msg/TimeReference](http://docs.ros.org/en/noetic/api/sensor_msgs/html/msg/TimeReference.html)
Expand Down
51 changes: 46 additions & 5 deletions oxts/launch/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,30 @@ def generate_launch_description():
driver_param_path = os.path.join(driver_dir, "config", parameters_file_name)
with open(driver_param_path, "r") as f:
driver_params = yaml.safe_load(f)["oxts_driver"]["ros__parameters"]
yaml_ncom = driver_params.pop("ncom", "")
yaml_ncom = driver_params.pop("ncom", '""')
yaml_prefix = driver_params.pop("topic_prefix", "ins")

yaml_ip = driver_params.pop("unit_ip","0.0.0.0")
yaml_port = driver_params.pop("unit_port",3000)
yaml_rate = driver_params.pop("ncom_rate",100)
yaml_mode = driver_params.pop("timestamp_mode",0)

ins_param_path = os.path.join(ins_dir, "config", parameters_file_name)
with open(ins_param_path, "r") as f:
ins_params = yaml.safe_load(f)["oxts_ins"]["ros__parameters"]

yaml_frameid = ins_params.pop("frame_id","oxts_link")
yaml_lrf = ins_params.pop("lrf_source",2)

use_sim_time = LaunchConfiguration("use_sim_time", default="False")
wait_for_init = LaunchConfiguration("wait_for_init", default="True")
ncom = LaunchConfiguration("ncom", default=yaml_ncom)
topic_prefix = LaunchConfiguration("topic_prefix", default=yaml_prefix)

unit_ip = LaunchConfiguration("unit_ip",default=yaml_ip)
unit_port = LaunchConfiguration("unit_port",default=yaml_port)
ncom_rate = LaunchConfiguration("ncom_rate",default=yaml_rate)
timestamp_mode = LaunchConfiguration("timestamp_mode",default=yaml_timestamp)

frame_id = LaunchConfiguration("frame_id",default=yaml_frameid)
lrf_source = LaunchConfiguration("lrf_source",default=yaml_lrf)
# declare launch arguments (this exposes the argument
# to IncludeLaunchDescriptionand to the command line)
declare_use_sim_time = DeclareLaunchArgument("use_sim_time", default_value="False")
Expand All @@ -47,7 +59,24 @@ def generate_launch_description():
declare_prefix = DeclareLaunchArgument(
"topic_prefix", default_value=yaml_prefix, description="Prefix to apply to all topics"
)

declare_ip = DeclareLaunchArgument(
"unit_ip", default_value=yaml_ip, description="Unit IP to connect to"
)
declare_port = DeclareLaunchArgument(
"unit_port", default_value=str(yaml_port), description="Unit Port to connect to"
)
declare_rate = DeclareLaunchArgument(
"ncom_rate", default_value=str(yaml_rate), description="Set ncom rate /Hz"
)
declare_mode = DeclareLaunchArgument(
"timestamp_mode", default_value=str(yaml_timestamp), description="Set timestamp mode"
)
declare_frameid = DeclareLaunchArgument(
"frame_id", default_value=yaml_frameid, description="Set id of frame"
)
declare_lrf = DeclareLaunchArgument(
"lrf_source", default_value=str(yaml_lrf), description="Set the lrf source"
)
oxts_driver_node = Node(
package="oxts_driver",
executable="oxts_driver",
Expand All @@ -59,6 +88,10 @@ def generate_launch_description():
{"wait_for_init": wait_for_init},
{"topic_prefix": topic_prefix},
{"ncom": ncom},
{"unit_ip": unit_ip},
{"unit_port": unit_port},
{"ncom_rate": ncom_rate},
{"timestamp_mode": timestamp_mode},
],
)

Expand All @@ -71,6 +104,8 @@ def generate_launch_description():
ins_params,
{"use_sim_time": use_sim_time},
{"topic_prefix": topic_prefix},
{"frame_id": frame_id},
{"lrf_source": lrf_source},
],
)

Expand All @@ -81,6 +116,12 @@ def generate_launch_description():
ld.add_action(declare_prefix)
ld.add_action(declare_use_sim_time)
ld.add_action(declare_wait_for_init)
ld.add_action(declare_ip)
ld.add_action(declare_port)
ld.add_action(declare_rate)
ld.add_action(declare_mode)
ld.add_action(declare_frameid)
ld.add_action(declare_lrf)
# launch nodes
ld.add_action(oxts_driver_node)
ld.add_action(oxts_ins_node)
Expand Down
6 changes: 3 additions & 3 deletions oxts/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<description>
ROS support for the OxTS RT/xNAV INS systems.
</description>
<maintainer email="support@oxts.com">oxts</maintainer>
<author>oxts</author>
<maintainer email="smccarthy@oxts.com">smccarthy</maintainer>
<author>Someone else maybe</author>
<license>Apache 2.0</license>
<url type="website">http://www.oxts.com</url>
<url type="website">http://www.ros.org/wiki/velodyne</url>
<url type="repository">https://github.com/OxfordTechnicalSolutions/oxts_ros2_driver</url>
<url type="bugtracker">https://github.com/OxfordTechnicalSolutions/oxts_ros2_driver/issues</url> -->

Expand Down
2 changes: 1 addition & 1 deletion oxts_driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ ament_target_dependencies(oxts_driver
tf2
tf2_kdl
oxts_msgs)

target_include_directories(oxts_driver PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PRIVATE ${Boost_INCLUDE_DIRS}
$<INSTALL_INTERFACE:include>)


install(TARGETS oxts_driver
DESTINATION lib/${PROJECT_NAME})

Expand Down
2 changes: 1 addition & 1 deletion oxts_driver/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<name>oxts_driver</name>
<version>0.0.0</version>
<description>A ROS2 Driver to allow an OxTS INS to interact with a wider ROS network.</description>
<maintainer email="support@oxts.com">oxts</maintainer>
<maintainer email="smccarthy@oxts.com">smccarthy</maintainer>
<license>Apache 2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>
Expand Down
2 changes: 1 addition & 1 deletion oxts_ins/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<name>oxts_ins</name>
<version>0.0.0</version>
<description>A ROS2 node that takes NCom messages from the driver node and publishes INS messages.</description>
<maintainer email="support@oxts.com">oxts</maintainer>
<maintainer email="smccarthy@oxts.com">smccarthy</maintainer>
<license>Apache 2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>
Expand Down
Empty file modified oxts_ins/urdf/small_core.stl
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion oxts_msgs/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<name>oxts_msgs</name>
<version>0.0.0</version>
<description>ROS2 message definitions for OxTS INSs.</description>
<maintainer email="support@oxts.com">oxts</maintainer>
<maintainer email="smccarthy@oxts.com">smccarthy</maintainer>
<license>Apache 2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>
Expand Down
21 changes: 17 additions & 4 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(Boost REQUIRED COMPONENTS unit_test_framework)
set(FastRTPS_INCLUDE_DIR /opt/ros/foxy/include)
set(FastRTPS_LIBRARY_RELEASE /opt/ros/foxy/lib/libfastrtps.so)

find_package(Boost REQUIRED COMPONENTS unit_test_framework system thread regex)
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
Expand All @@ -24,6 +27,8 @@ find_package(tf2_ros REQUIRED)
find_package(tf2_kdl REQUIRED)
find_package(oxts_msgs REQUIRED)

message(STATUS "current source dir: ${CMAKE_CURRENT_SOURCE_DIR}")

add_executable(tests
tests.cpp
oxts_driver.cpp
Expand All @@ -47,13 +52,21 @@ ament_target_dependencies(tests
tf2_kdl
oxts_msgs)

add_custom_command(
TARGET tests POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/test.ncom
${CMAKE_CURRENT_BINARY_DIR}/test.ncom)

message(STATUS "include dirs: ${Boost_INCLUDE_DIRS}")

target_include_directories(tests PUBLIC
../oxts_driver/include
../oxts_ins/include
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PRIVATE ${Boost_INCLUDE_DIRS}
$<INSTALL_INTERFACE:include>)
target_link_libraries (tests ${Boost_LIBRARIES})

install(TARGETS tests
DESTINATION lib/${PROJECT_NAME})
target_link_libraries (tests
${Boost_LIBRARIES}
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
28 changes: 28 additions & 0 deletions tests/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>tests</name>
<version>0.0.0</version>
<description>A ROS2 node that runs unit tests.</description>
<maintainer email="[email protected]">smccarthy</maintainer>
<license>Apache 2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>

<depend>rclcpp</depend>
<depend>std_msgs</depend>
<depend>sensor_msgs</depend>
<depend>geometry_msgs</depend>
<depend>nav_msgs</depend>
<depend>tf2</depend>
<depend>tf2_ros</depend>
<depend>tf2_kdl</depend>
<depend>oxts_msgs</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
3 changes: 2 additions & 1 deletion tests/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <boost/test/unit_test.hpp>
#include <memory>
#include <filesystem>

#include "oxts_driver/driver.hpp"
#include "tests.h"
Expand All @@ -25,7 +26,7 @@ namespace tests {
std::unique_ptr<oxts_driver::OxtsDriver> newDriver() {
rclcpp::NodeOptions options;
options.append_parameter_override(
"ncom", std::filesystem::path{__FILE__}.replace_filename("test.ncom"));
"ncom", std::filesystem::canonical(std::filesystem::path{"./test.ncom"}));
options.append_parameter_override("ncom_rate", 250);
return std::make_unique<oxts_driver::OxtsDriver>(options);
}
Expand Down

0 comments on commit 9e57d02

Please sign in to comment.