Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.5)
project(adnav-ros2)
project(ros2-driver)

# Default to C99
if(NOT CMAKE_C_STANDARD)
Expand All @@ -16,14 +16,16 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
endif()

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(diagnostic_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(rclcpp REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(std_msgs REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_ros REQUIRED)

add_executable(adnav_driver src/advanced_navigation_driver.cpp src/rs232/rs232.c src/an_packet_protocol.c src/spatial_packets.c src/NTRIP_Client/NTRIP/ntripclient.c)
ament_target_dependencies(adnav_driver rclcpp std_msgs sensor_msgs diagnostic_msgs geometry_msgs)
ament_target_dependencies(adnav_driver rclcpp std_msgs sensor_msgs diagnostic_msgs geometry_msgs tf2 tf2_ros)

install(TARGETS
adnav_driver
Expand Down
18 changes: 7 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,22 @@ The following guides are useful in getting started with ROS2 if you are not fami

## Build Instruction

- Packages should be created in the src directory, not the root of the workspace. Navigate to `workspace-folder-name/src`, and run the package create command:
- Packages should be created in the src directory, not the root of the workspace. Navigate to `workspace-folder-name/src`, and get the Advanced Navigation ROS2 Driver
```
ros2 pkg create --build-type ament_cmake adnav-ros2
```
- Your terminal should return a message verifying the creation of your package and all its necessary files and folders. Navigate to `workspace-folder-name/src/adnav-ros2/src`.
- Get the Advanced Navigation ROS2 Driver
```
wget Something TODO
git clone https://github.com/advanced-navigation/ros2-driver.git
```
- You likely already have the `rclpp` and `std_msgs` packages installed as part of your ROS2 system. Either way, it’s good practice to run rosdep in the root of your workspace (`workspace-folder-name`) to check for missing dependencies before building:
```
rosdep install -i --from-path src --rosdistro foxy -y
```
- In the root of your workspace, workspace-folder-name, source and build the package:
- In the root of your workspace, `workspace-folder-name`, source and build the package:
- Source the ROS2 Environment to the current folder:
```
source /opt/ros/foxy/setup.bash
```
- Build your new package:
```
colcon build --packages-select adnav-ros2
colcon build --packages-select ros2-driver
```

## Device Configuration
Expand All @@ -61,6 +56,7 @@ If you are not sure how to configure your Advanced Navigation Device please refe

Open a new terminal or new tab, navigate to `workspace-folder-name`, and source the setup files:
```
source /opt/ros/foxy/setup.bash
. install/setup.bash
```

Expand All @@ -73,7 +69,7 @@ Open a new terminal or new tab, navigate to `workspace-folder-name`, and source
baud_rate The Baud rate configured on the device. Default 115200
comm_port The COM port of the connected device. Default /dev/ttyUSB0
```
***e.g. ros2 run adnav-ros2 adnav_driver 115200 /dev/ttyUSB0***
***e.g. ros2 run ros2-driver adnav_driver 115200 /dev/ttyUSB0***
2. Baud Rate, Comm Port and NTRIP as arguments:
```
ros2 run package_name executable_name -B [baud_rate] -D [comm_port] -s [server_url] -m [mountpoint] -u [username] -p [password]
Expand All @@ -86,7 +82,7 @@ Open a new terminal or new tab, navigate to `workspace-folder-name`, and source
-u username Username of your NTRIP account
-p password Password of your NTRIP account
```
***e.g. ros2 run adnav-ros2 adnav_driver -B 115200 -D /dev/ttyUSB0 -s alldayrtk.com -m MOUNTPOINT_20 -u yourUsername -p yourPassword***
***e.g. ros2 run ros2-driver adnav_driver -B 115200 -D /dev/ttyUSB0 -s alldayrtk.com -m MOUNTPOINT_20 -u yourUsername -p yourPassword***


## Published Topics
Expand Down
10 changes: 6 additions & 4 deletions package.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<?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>adnav-ros2</name>
<name>ros2-driver</name>
<version>2.0.0</version>
<description>Advanced Navigation ROS 2 Driver</description>
<maintainer email="support@advancednavigation.com">Support</maintainer>
<license>MIT</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<depend>rclcpp</depend>
<depend>std_msgs</depend>
<depend>sensor_msgs</depend>
<depend>diagnostic_msgs</depend>
<depend>geometry_msgs</depend>
<depend>rclcpp</depend>
<depend>sensor_msgs</depend>
<depend>std_msgs</depend>
<depend>tf2</depend>
<depend>tf2_ros</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
Expand Down
4 changes: 2 additions & 2 deletions src/advanced_navigation_driver.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/****************************************************************/
/* */
/* Advanced Navigation */
/* ROS2 Driver */
/* Advanced Navigation */
/* ROS2 Driver */
/* Copyright 2020, Advanced Navigation Pty Ltd */
/* */
/****************************************************************/
Expand Down
11 changes: 6 additions & 5 deletions src/rs232/rs232.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@


int Cport,
error;
rs232_error;

struct termios new_port_settings,
old_port_settings;
Expand Down Expand Up @@ -108,8 +108,8 @@ int OpenComport(char *comport, int baudrate)
return(1);
}

error = tcgetattr(Cport, &old_port_settings);
if(error==-1)
rs232_error = tcgetattr(Cport, &old_port_settings);
if(rs232_error==-1)
{
close(Cport);
perror("unable to read portsettings ");
Expand All @@ -123,8 +123,8 @@ int OpenComport(char *comport, int baudrate)
new_port_settings.c_lflag = 0;
new_port_settings.c_cc[VMIN] = 0; /* block untill n bytes are received */
new_port_settings.c_cc[VTIME] = 1; /* block untill a timer expires (n * 100 mSec.) */
error = tcsetattr(Cport, TCSANOW, &new_port_settings);
if(error==-1)
rs232_error = tcsetattr(Cport, TCSANOW, &new_port_settings);
if(rs232_error==-1)
{
close(Cport);
perror("unable to adjust portsettings ");
Expand Down Expand Up @@ -367,3 +367,4 @@ int IsCTSEnabled()

#endif