Skip to content

Commit

Permalink
Support fastdds's 3.0.x-devel (#125)
Browse files Browse the repository at this point in the history
* Refs #17138. Support 3.0.x-devel

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>

* Refs #17138: Apply Edu's suggestions

Signed-off-by: eduponz <eduardoponz@eprosima.com>

* Refs #17138: Adjust workflow to 3.0.x-devel

Signed-off-by: eduponz <eduardoponz@eprosima.com>

---------

Signed-off-by: Ricardo González Moreno <ricardo@richiware.dev>
Signed-off-by: eduponz <eduardoponz@eprosima.com>
Co-authored-by: eduponz <eduardoponz@eprosima.com>
  • Loading branch information
richiware and EduPonz authored Apr 23, 2024
1 parent 58bbc8a commit d592565
Show file tree
Hide file tree
Showing 39 changed files with 1,223 additions and 2,905 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build.meta
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
names:
fastrtps:
fastdds:
cmake-args:
- "-DNO_TLS=ON"
- "-DSECURITY=OFF"

14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ on:
fastcdr_versions:
description: 'Fast-CDR branches to be used'
required: false
default: '["1.1.x", "master"]'
default: '["master"]'
fastdds_branch:
description: 'Fast-DDS branch to be used'
required: false
default: 'master'
default: '3.0.x-devel'
pull_request:
push:
branches:
- master
- 3.0.x-devel
schedule:
- cron: '0 0 * * *'

Expand All @@ -27,7 +27,7 @@ jobs:
runs-on: windows-2019
strategy:
matrix:
fastcdr_version: ${{ fromJson(github.event.inputs.fastcdr_versions || '["1.1.x", "master"]') }}
fastcdr_version: ${{ fromJson(github.event.inputs.fastcdr_versions || '["master"]') }}

env:
CXXFLAGS: /MP
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
with:
foonathan-memory-vendor-branch: ${{ github.event.inputs.foonathan_memory_vendor_branch || 'master' }}
fastcdr-branch: ${{ matrix.fastcdr_version }}
fastdds-branch: ${{ github.event.inputs.fastdds_branch || 'master' }}
fastdds-branch: ${{ github.event.inputs.fastdds_branch || '3.0.x-devel' }}

- uses: eProsima/eProsima-CI/external/get-cmake@v0
with:
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
fastcdr_version: ${{ fromJson(github.event.inputs.fastcdr_versions || '["1.1.x", "master"]') }}
fastcdr_version: ${{ fromJson(github.event.inputs.fastcdr_versions || '["master"]') }}

steps:
- uses: eProsima/eProsima-CI/external/checkout@v0
Expand All @@ -126,7 +126,7 @@ jobs:
with:
foonathan-memory-vendor-branch: ${{ github.event.inputs.foonathan_memory_vendor_branch || 'master' }}
fastcdr-branch: ${{ matrix.fastcdr_version }}
fastdds-branch: ${{ github.event.inputs.fastdds_branch || 'master' }}
fastdds-branch: ${{ github.event.inputs.fastdds_branch || '3.0.x-devel' }}

- uses: eProsima/eProsima-CI/external/get-cmake@v0
with:
Expand Down
19 changes: 10 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ option(EPROSIMA_BUILD "Activate internal building" OFF)
###############################################################################
# Load external eProsima projects.
###############################################################################
set(FASTDDS_MIN_VERSION "2.12.1")
set(FASTDDS_MIN_VERSION "3.0.0")

find_package(fastcdr REQUIRED)
find_package(fastrtps ${FASTDDS_MIN_VERSION} REQUIRED)
find_package(fastdds ${FASTDDS_MIN_VERSION} REQUIRED)

# If ROS environment is not set, disable ROS features. If there's no TypeSupport for the ROS 2 type, disable them as well.
if (DEFINED ENV{ROS_VERSION})
Expand Down Expand Up @@ -198,18 +198,14 @@ set( SHAPESDEMO_SOURCES
src/shapesdemo/ShapePublisher.cpp
src/shapesdemo/ShapesDemo.cpp
src/shapesdemo/ShapeSubscriber.cpp
types/Shape.cxx
types/Shapev1.cxx
types/ShapePubSubTypes.cxx
types/ShapeTypeObject.cxx
types/ShapeTypeObjectSupport.cxx
)

if(BUILD_ROS_COMPONENTS)
list( APPEND SHAPESDEMO_SOURCES
types/KeylessShapeType.cxx
types/KeylessShapeTypev1.cxx
types/KeylessShapeTypePubSubTypes.cxx
types/KeylessShapeTypeTypeObject.cxx
types/KeylessShapeTypeTypeObjectSupport.cxx
)
endif()

Expand All @@ -226,7 +222,12 @@ if(BUILD_ROS_COMPONENTS)
target_compile_definitions(${PROJECT_NAME} PRIVATE -DENABLE_ROS_COMPONENTS)
endif()

target_link_libraries(${PROJECT_NAME} fastrtps fastcdr Qt5::Widgets Qt5::Core Qt5::Gui)
target_link_libraries(${PROJECT_NAME}
fastcdr
fastdds
Qt5::Core
Qt5::Widgets
Qt5::Gui)

###############################################################################
# Install
Expand Down
20 changes: 10 additions & 10 deletions ShapesDemo.pro
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ FORMS += forms/mainwindow.ui \
forms/subscribedialog.ui \
forms/optionsdialog.ui

unix: CONFIG(release, debug|release):LIBS += -Lusr/lib/ -lfastrtps
else:unix: CONFIG(debug, debug|release):LIBS += -Lusr/lib/ -lfastrtpsd
unix: CONFIG(release, debug|release):LIBS += -Lusr/lib/ -lfastdds
else:unix: CONFIG(debug, debug|release):LIBS += -Lusr/lib/ -lfastddsd

INCLUDEPATH += $$PWD/include
INCLUDEPATH += $$PWD/thirdparty/eprosima-common-code
#DEPENDPATH += $$PWD/include
#DEPENDPATH += $$PWD/thirdparty/eprosima-common-code

#unix: CONFIG(debug, debug|release): PRE_TARGETDEPS += usr/lib/libfastrtpsd.a
#else:unix: CONFIG(release, debug|release): PRE_TARGETDEPS += usr/lib/libfastrtps.a
#unix: CONFIG(debug, debug|release): PRE_TARGETDEPS += usr/lib/libfastddsd.a
#else:unix: CONFIG(release, debug|release): PRE_TARGETDEPS += usr/lib/libfastdds.a



Expand Down Expand Up @@ -104,23 +104,23 @@ SOURCES += \



win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../lib/i86Win32VS2010 -llibfastrtps-1.0.0 -L"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib" -lShlwapi -lIphlpapi
win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../lib/i86Win32VS2010 -llibfastrtpsd-1.0.0 -L"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib" -lShlwapi -lIphlpapi
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../lib/i86Win32VS2010 -llibfastdds-1.0.0 -L"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib" -lShlwapi -lIphlpapi
win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../lib/i86Win32VS2010 -llibfastddsd-1.0.0 -L"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib" -lShlwapi -lIphlpapi




#win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../lib/i86Win32VS2010/libfastrtps-1.0.0.lib
#win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../lib/i86Win32VS2010/libfastrtpsd-1.0.0.lib
#win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../lib/i86Win32VS2010/libfastdds-1.0.0.lib
#win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../lib/i86Win32VS2010/libfastddsd-1.0.0.lib



#win32:INCLUDEPATH += $$PWD/../../include
#win32:DEPENDPATH += $$PWD/../../lib/i86Win32VS2010 C:\Windows\System32


#win32:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../lib/i86Win32VS2010/libfastrtps-0.5.1.lib Shlwapi.lib Iphlpapi.lib
#win32:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../lib/i86Win32VS2010/libfastrtpsd-0.5.1.lib Shlwapi.lib Iphlpapi.lib
#win32:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../lib/i86Win32VS2010/libfastdds-0.5.1.lib Shlwapi.lib Iphlpapi.lib
#win32:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../lib/i86Win32VS2010/libfastddsd-0.5.1.lib Shlwapi.lib Iphlpapi.lib

RESOURCES += \
images/eprosimalogo.qrc
Expand Down
2 changes: 1 addition & 1 deletion colcon.pkg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "ShapesDemo",
"type": "cmake",
"dependencies" : ["fastrtps", "fastcdr", "shapes_demo_typesupport"]
"dependencies" : ["fastdds", "fastcdr", "shapes_demo_typesupport"]
}
1 change: 1 addition & 0 deletions idl/Shape.idl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@appendable
struct ShapeType {
@Key string color;
long x;
Expand Down
5 changes: 3 additions & 2 deletions include/eprosimashapesdemo/shapesdemo/ShapeHistory.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
#ifndef SHAPEHISTORY_H
#define SHAPEHISTORY_H

#include "eprosimashapesdemo/shapesdemo/ShapeInfo.h"
#include <cstdint>
#include <vector>
#include <list>
#include <cstdint>

#include "eprosimashapesdemo/shapesdemo/ShapeInfo.h"

/**
* @brief The ShapeFilter class, represents a filter.
Expand Down
6 changes: 3 additions & 3 deletions include/eprosimashapesdemo/shapesdemo/ShapeSubscriber.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include "eprosimashapesdemo/shapesdemo/ShapeHistory.h"
#include "eprosimashapesdemo/shapesdemo/ShapesDemo.h"
#include "types/Shape.h"
#include "types/Shape.hpp"

using namespace eprosima::fastdds::dds;

Expand Down Expand Up @@ -97,11 +97,11 @@ class ShapeSubscriber

void on_requested_deadline_missed(
DataReader* reader,
const eprosima::fastrtps::RequestedDeadlineMissedStatus& status) override;
const RequestedDeadlineMissedStatus& status) override;

void on_liveliness_changed(
DataReader* reader,
const eprosima::fastrtps::LivelinessChangedStatus& status) override;
const LivelinessChangedStatus& status) override;

void on_requested_incompatible_qos(
DataReader* reader,
Expand Down
22 changes: 11 additions & 11 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@
// You should have received a copy of the GNU General Public License
// along with eProsima Fast DDS Shapes Demo. If not, see <https://www.gnu.org/licenses/>.

#include <eprosimashapesdemo/qt/mainwindow.h>
#include <fastrtps/log/Log.h>
#include <QApplication>
#include <eprosimashapesdemo/utils/md5.h>
#include <fastrtps/Domain.h>

#include <eprosimashapesdemo/qt/mainwindow.h>

#ifdef WIN32
int __stdcall WinMain(
_In_ HINSTANCE /*hInstance*/,
_In_ HINSTANCE /*hPrevInstance*/,
_In_ char* /*lpCmdLine*/,
_In_ int /*nCmdShow*/
)
_In_ HINSTANCE /*hInstance*/,
_In_ HINSTANCE /*hPrevInstance*/,
_In_ char* /*lpCmdLine*/,
_In_ int /*nCmdShow*/
)
{
int argc = 0;
QApplication a(argc, NULL);
#else
int main(int argc, char *argv[])
int main(
int argc,
char* argv[])
{
QApplication a(argc, argv);
#endif
#endif // ifdef WIN32
MainWindow w;
w.show();

Expand Down
11 changes: 0 additions & 11 deletions src/qt/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,22 +472,11 @@ void MainWindow::on_actionAbout_triggered()

void MainWindow::on_actionUser_Manual_triggered()
{
//QDesktopServices::openUrl(QUrl("file:///C:/Program Files/eProsima/FastRTPS/doc/pdf/FastRTPS_ShapesDemo_User_Manual.pdf"));
//QDesktopServices::openUrl(QUrl("http://git.sambaserver.eprosima.com/rtps/shapesdemo/source/README.md"));
QDesktopServices::openUrl(QUrl("https://eprosima-shapes-demo.readthedocs.io/en/latest/"));
//QString str(QDir::currentPath());
//str.append("/FASTRTPSGEN_User_Manual.pdf");
//QDesktopServices::openUrl(QUrl(str, QUrl::TolerantMode));
}

void MainWindow::on_actionInteroperability_Troubleshooting_triggered()
{
//QDesktopServices::openUrl(QUrl("file:///C:/Program Files/eProsima/FastRTPS/doc/pdf/FastRTPS_ShapesDemo_Interoperability_Troubleshooting.pdf"));
QDesktopServices::openUrl(QUrl(
"https://eprosima-shapes-demo.readthedocs.io/en/latest/troubleshooting/troubleshooting.html"));

//QString str(QDir::currentPath());

//str.append("/FASTRTPSGEN_User_Manual.pdf");
//QDesktopServices::openUrl(QUrl(str, QUrl::TolerantMode));
}
4 changes: 2 additions & 2 deletions src/qt/optionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
// You should have received a copy of the GNU General Public License
// along with eProsima Fast DDS Shapes Demo. If not, see <https://www.gnu.org/licenses/>.

#include <fastdds/config.h> // FASTDDS_STATISTICS availability

#include "eprosimashapesdemo/qt/optionsdialog.h"
#include "ui_optionsdialog.h"
#include "eprosimashapesdemo/shapesdemo/ShapesDemo.h"
#include "eprosimashapesdemo/qt/mainwindow.h"

#include <fastrtps/config.h> // FASTDDS_STATISTICS availability

OptionsDialog::OptionsDialog(
MainWindow* mw,
ShapesDemo* psd,
Expand Down
4 changes: 2 additions & 2 deletions src/qt/participantdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <fastdds/config.h> // FASTDDS_STATISTICS availability

#include "eprosimashapesdemo/qt/participantdialog.h"
#include "ui_participantdialog.h"
#include "eprosimashapesdemo/shapesdemo/ShapesDemo.h"
#include "eprosimashapesdemo/qt/mainwindow.h"

#include <fastrtps/config.h> // FASTDDS_STATISTICS availability

ParticipantDialog::ParticipantDialog(
MainWindow* mw,
ShapesDemo* psd,
Expand Down
32 changes: 26 additions & 6 deletions src/shapesdemo/ShapeHistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@
// You should have received a copy of the GNU General Public License
// along with eProsima Fast DDS Shapes Demo. If not, see <https://www.gnu.org/licenses/>.

#include <cmath>

#include <fastdds/rtps/common/Guid.h>
#include <fastdds/rtps/common/Time_t.h>

#include <eprosimashapesdemo/shapesdemo/ShapeHistory.h>
#include <fastrtps/utils/TimeConversion.h>

using namespace eprosima::fastrtps::rtps;
using namespace eprosima::fastdds::rtps;

inline bool compareGUID(
GUID_t& g1,
GUID_t& g2)
eprosima::fastrtps::rtps::GUID_t& g1,
eprosima::fastrtps::rtps::GUID_t& g2)
{
for (uint8_t i = 0; i < 16; ++i)
{
Expand Down Expand Up @@ -52,6 +56,22 @@ inline bool compareGUID(
return false;
}

inline double Time_tAbsDiff2DoubleMillisec(
const Time_t& t1,
const Time_t& t2)
{
double result = 0;
result += (double)abs((t2.seconds - t1.seconds) * 1000);
result += (double)std::abs((t2.fraction() - t1.fraction()) / pow(2.0, 32) * 1000);
return result;
}

inline double Time_t2MilliSecondsDouble(
const Time_t& t)
{
return ((double)t.fraction() / pow(2.0, 32) * pow(10.0, 3)) + (double)t.seconds * pow(10.0, 3);
}

bool ShapeHistory::addToHistory(
Shape& sh)
{
Expand Down Expand Up @@ -102,8 +122,8 @@ bool ShapeHistory::passTimeFilter(
}
else
{
if (TimeConv::Time_tAbsDiff2DoubleMillisec(sh_in.m_time, sh_last.m_time)
>= TimeConv::Time_t2MilliSecondsDouble(m_filter.m_minimumSeparation))
if (Time_tAbsDiff2DoubleMillisec(sh_in.m_time, sh_last.m_time)
>= Time_t2MilliSecondsDouble(m_filter.m_minimumSeparation))
{
return true;
}
Expand Down
6 changes: 2 additions & 4 deletions src/shapesdemo/ShapePublisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
*/

#include "eprosimashapesdemo/shapesdemo/ShapePublisher.h"
#include "fastrtps/Domain.h"
#include "fastrtps/publisher/Publisher.h"

#include <eprosimashapesdemo/qt/mainwindow.h>
#include <thread>
Expand Down Expand Up @@ -58,7 +56,7 @@ ShapePublisher::~ShapePublisher()
}
mp_datawriter->wait_for_acknowledgments(wait_time);

if (ReturnCode_t::RETCODE_OK != mp_publisher->delete_datawriter(mp_datawriter))
if (RETCODE_OK != mp_publisher->delete_datawriter(mp_datawriter))
{
std::cerr << "Error deleting datawriter: " << mp_datawriter->guid() << std::endl;
return;
Expand All @@ -67,7 +65,7 @@ ShapePublisher::~ShapePublisher()

if (mp_sd->getParticipant() && mp_publisher)
{
if (ReturnCode_t::RETCODE_OK != mp_sd->getParticipant()->delete_publisher(mp_publisher))
if (RETCODE_OK != mp_sd->getParticipant()->delete_publisher(mp_publisher))
{
std::cerr << "Error deleting publisher: " << std::endl;
return;
Expand Down
Loading

0 comments on commit d592565

Please sign in to comment.