Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add various moveit, rviz and ur packages required by IIT internal projects #19

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
4 changes: 4 additions & 0 deletions patch/dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,7 @@ gz_ogre_next_vendor:
add_run: ["ogre-next"]
rosx_introspection:
add_host: ["rapidjson"]
gz_ros2_control:
add_host: ["REQUIRE_OPENGL"]
gz_ros2_control_demos:
add_host: ["REQUIRE_OPENGL"]
12 changes: 12 additions & 0 deletions patch/ros-jazzy-ackermann-steering-controller.win.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/ackermann_steering_controller/CMakeLists.txt b/ackermann_steering_controller/CMakeLists.txt
index 6ad0e9485f..874e9055b3 100644
--- a/ackermann_steering_controller/CMakeLists.txt
+++ b/ackermann_steering_controller/CMakeLists.txt
@@ -4,6 +4,7 @@ project(ackermann_steering_controller LANGUAGES CXX)
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
add_compile_options(-Wall -Wextra -Wpedantic -Wconversion)
endif()
+set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

# find dependencies
set(THIS_PACKAGE_INCLUDE_DEPENDS
14 changes: 14 additions & 0 deletions patch/ros-jazzy-admittance-controller.win.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

diff --git a/admittance_controller/CMakeLists.txt b/admittance_controller/CMakeLists.txt
index 884513deef..359e55b46d 100644
--- a/admittance_controller/CMakeLists.txt
+++ b/admittance_controller/CMakeLists.txt
@@ -7,6 +7,8 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
-Werror=missing-braces)
endif()

+set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+
set(THIS_PACKAGE_INCLUDE_DEPENDS
angles
control_msgs
40 changes: 40 additions & 0 deletions patch/ros-jazzy-gz-ros2-control.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
diff --git a/gz_ros2_control/CMakeLists.txt b/gz_ros2_control/CMakeLists.txt
index 196f62d5..a7bdfd01 100644
--- a/gz_ros2_control/CMakeLists.txt
+++ b/gz_ros2_control/CMakeLists.txt
@@ -24,6 +24,12 @@ find_package(pluginlib REQUIRED)
find_package(rclcpp REQUIRED)
find_package(yaml_cpp_vendor REQUIRED)

+# Compatibility with https://github.com/gazebosim/gz-cmake/blob/eb1c510e6278935eb742ed92c6a6d1388439f8bd/cmake/FindTINYXML2.cmake#L4
+if(NOT TARGET TINYXML2::TINYXML2)
+ add_library(TINYXML2::TINYXML2 INTERFACE IMPORTED)
+ set_property(TARGET tinyxml2::tinyxml2 PROPERTY INTERFACE_LINK_LIBRARIES tinyxml2::tinyxml2)
+endif()
+set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
find_package(gz_sim_vendor REQUIRED)
find_package(gz-sim REQUIRED)

diff --git a/gz_ros2_control/src/gz_ros2_control_plugin.cpp b/gz_ros2_control/src/gz_ros2_control_plugin.cpp
index d38ce556..333d42a5 100644
--- a/gz_ros2_control/src/gz_ros2_control_plugin.cpp
+++ b/gz_ros2_control/src/gz_ros2_control_plugin.cpp
@@ -15,5 +15,3 @@
-#include <unistd.h>
-
#include <chrono>
#include <map>
#include <memory>

diff --git a/gz_ros2_control/src/gz_system.cpp b/gz_ros2_control/src/gz_system.cpp
index 5c9952b9..d5554d2c 100644
--- a/gz_ros2_control/src/gz_system.cpp
+++ b/gz_ros2_control/src/gz_system.cpp
@@ -51,3 +51,7 @@
+#ifdef ERROR
+#undef ERROR
+#endif
+
struct jointData
{
/// \brief Joint's names.
15 changes: 15 additions & 0 deletions patch/ros-jazzy-kinematics-interface-kdl.win.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index afeadae..c1cc640 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,10 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

+# using this instead of visibility macros
+# S1 from https://github.com/ros-controls/ros2_controllers/issues/1053
+set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+
set(THIS_PACKAGE_INCLUDE_DEPENDS
kdl_parser
kinematics_interface
15 changes: 15 additions & 0 deletions patch/ros-jazzy-kinematics-interface.win.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 88eaf9e..f0dbffd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,10 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

+# using this instead of visibility macros
+# S1 from https://github.com/ros-controls/ros2_controllers/issues/1053
+set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+
set(THIS_PACKAGE_INCLUDE_DEPENDS
rclcpp
rclcpp_lifecycle
15 changes: 15 additions & 0 deletions patch/ros-jazzy-steering-controllers-library.win.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/steering_controllers_library/CMakeLists.txt b/steering_controllers_library/CMakeLists.txt
index fc79d54b7c..2e80ed198f 100644
--- a/steering_controllers_library/CMakeLists.txt
+++ b/steering_controllers_library/CMakeLists.txt
@@ -7,6 +7,10 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
-Werror=missing-braces)
endif()

+# using this instead of visibility macros
+# S1 from https://github.com/ros-controls/ros2_controllers/issues/1053
+set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+
# find dependencies
set(THIS_PACKAGE_INCLUDE_DEPENDS
control_msgs
17 changes: 17 additions & 0 deletions patch/ros-jazzy-tinyxml2-vendor.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/cmake/Modules/FindTinyXML2.cmake b/cmake/Modules/FindTinyXML2.cmake
index 87991be..5436d86 100644
--- a/cmake/Modules/FindTinyXML2.cmake
+++ b/cmake/Modules/FindTinyXML2.cmake
@@ -67,6 +67,12 @@ else()
set_property(TARGET tinyxml2::tinyxml2 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${TINYXML2_INCLUDE_DIR})
list(APPEND TinyXML2_TARGETS tinyxml2::tinyxml2)
endif()
+
+ # Compatibility with https://github.com/gazebosim/gz-cmake/blob/eb1c510e6278935eb742ed92c6a6d1388439f8bd/cmake/FindTINYXML2.cmake#L4
+ if(NOT TARGET TINYXML2::TINYXML2)
+ add_library(TINYXML2::TINYXML2 INTERFACE IMPORTED)
+ set_property(TARGET TINYXML2::TINYXML2 PROPERTY INTERFACE_LINK_LIBRARIES tinyxml2::tinyxml2)
+ endif()
endif()

# Set mixed case INCLUDE_DIRS and LIBRARY variables from upper case ones.
249 changes: 249 additions & 0 deletions patch/ros-jazzy-ur-client-library.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
diff --git a/include/ur_client_library/portable_endian.h b/include/ur_client_library/portable_endian.h
new file mode 100644
index 0000000..2b43378
--- /dev/null
+++ b/include/ur_client_library/portable_endian.h
@@ -0,0 +1,118 @@
+// "License": Public Domain
+// I, Mathias Panzenböck, place this file hereby into the public domain. Use it at your own risk for whatever you like.
+// In case there are jurisdictions that don't support putting things in the public domain you can also consider it to
+// be "dual licensed" under the BSD, MIT and Apache licenses, if you want to. This code is trivial anyway. Consider it
+// an example on how to get the endian conversion functions on different platforms.
+
+#ifndef PORTABLE_ENDIAN_H__
+#define PORTABLE_ENDIAN_H__
+
+#if (defined(_WIN16) || defined(_WIN32) || defined(_WIN64)) && !defined(__WINDOWS__)
+
+# define __WINDOWS__
+
+#endif
+
+#if defined(__linux__) || defined(__CYGWIN__)
+
+# include <endian.h>
+
+#elif defined(__APPLE__)
+
+# include <libkern/OSByteOrder.h>
+
+# define htobe16(x) OSSwapHostToBigInt16(x)
+# define htole16(x) OSSwapHostToLittleInt16(x)
+# define be16toh(x) OSSwapBigToHostInt16(x)
+# define le16toh(x) OSSwapLittleToHostInt16(x)
+
+# define htobe32(x) OSSwapHostToBigInt32(x)
+# define htole32(x) OSSwapHostToLittleInt32(x)
+# define be32toh(x) OSSwapBigToHostInt32(x)
+# define le32toh(x) OSSwapLittleToHostInt32(x)
+
+# define htobe64(x) OSSwapHostToBigInt64(x)
+# define htole64(x) OSSwapHostToLittleInt64(x)
+# define be64toh(x) OSSwapBigToHostInt64(x)
+# define le64toh(x) OSSwapLittleToHostInt64(x)
+
+# define __BYTE_ORDER BYTE_ORDER
+# define __BIG_ENDIAN BIG_ENDIAN
+# define __LITTLE_ENDIAN LITTLE_ENDIAN
+# define __PDP_ENDIAN PDP_ENDIAN
+
+#elif defined(__OpenBSD__)
+
+# include <sys/endian.h>
+
+#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__)
+
+# include <sys/endian.h>
+
+# define be16toh(x) betoh16(x)
+# define le16toh(x) letoh16(x)
+
+# define be32toh(x) betoh32(x)
+# define le32toh(x) letoh32(x)
+
+# define be64toh(x) betoh64(x)
+# define le64toh(x) letoh64(x)
+
+#elif defined(__WINDOWS__)
+
+# include <winsock2.h>
+# include <sys/param.h>
+
+# if BYTE_ORDER == LITTLE_ENDIAN
+
+# define htobe16(x) htons(x)
+# define htole16(x) (x)
+# define be16toh(x) ntohs(x)
+# define le16toh(x) (x)
+
+# define htobe32(x) htonl(x)
+# define htole32(x) (x)
+# define be32toh(x) ntohl(x)
+# define le32toh(x) (x)
+
+# define htobe64(x) htonll(x)
+# define htole64(x) (x)
+# define be64toh(x) ntohll(x)
+# define le64toh(x) (x)
+
+# elif BYTE_ORDER == BIG_ENDIAN
+
+ /* that would be xbox 360 */
+# define htobe16(x) (x)
+# define htole16(x) __builtin_bswap16(x)
+# define be16toh(x) (x)
+# define le16toh(x) __builtin_bswap16(x)
+
+# define htobe32(x) (x)
+# define htole32(x) __builtin_bswap32(x)
+# define be32toh(x) (x)
+# define le32toh(x) __builtin_bswap32(x)
+
+# define htobe64(x) (x)
+# define htole64(x) __builtin_bswap64(x)
+# define be64toh(x) (x)
+# define le64toh(x) __builtin_bswap64(x)
+
+# else
+
+# error byte order not supported
+
+# endif
+
+# define __BYTE_ORDER BYTE_ORDER
+# define __BIG_ENDIAN BIG_ENDIAN
+# define __LITTLE_ENDIAN LITTLE_ENDIAN
+# define __PDP_ENDIAN PDP_ENDIAN
+
+#else
+
+# error platform not supported
+
+#endif
+
+#endif

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e95db8f..2620abd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -63,6 +63,9 @@ endif()
if(CMAKE_THREAD_LIBS_INIT)
target_link_libraries(urcl PUBLIC "${CMAKE_THREAD_LIBS_INIT}")
endif()
+if(UNIX AND NOT APPLE)
+ target_link_libraries(urcl PUBLIC "rt")
+endif()

##
## Build testing if enabled by option
@@ -75,7 +78,7 @@ else()
endif()


-target_link_libraries(urcl INTERFACE ${Boost_Libraries})
+target_link_libraries(urcl INTERFACE ${Boost_LIBRARIES})

add_subdirectory(examples)

diff --git a/include/ur_client_library/comm/bin_parser.h b/include/ur_client_library/comm/bin_parser.h
index cad7c63..91af811 100644
--- a/include/ur_client_library/comm/bin_parser.h
+++ b/include/ur_client_library/comm/bin_parser.h
@@ -21,7 +21,6 @@
#pragma once

#include <assert.h>
-#include <endian.h>
#include <inttypes.h>
#include <array>
#include <bitset>
@@ -29,6 +28,7 @@
#include <cstring>
#include <string>
#include <memory>
+#include "ur_client_library/portable_endian.h"
#include "ur_client_library/log.h"
#include "ur_client_library/types.h"
#include "ur_client_library/exceptions.h"
diff --git a/include/ur_client_library/comm/package_serializer.h b/include/ur_client_library/comm/package_serializer.h
index 7745da9..ded500a 100644
--- a/include/ur_client_library/comm/package_serializer.h
+++ b/include/ur_client_library/comm/package_serializer.h
@@ -29,8 +29,8 @@
#ifndef UR_CLIENT_LIBRARY_PACKAGE_SERIALIZER_H_INCLUDED
#define UR_CLIENT_LIBRARY_PACKAGE_SERIALIZER_H_INCLUDED

-#include <endian.h>
#include <cstring>
+#include "ur_client_library/portable_endian.h"

namespace urcl
{
diff --git a/include/ur_client_library/control/reverse_interface.h b/include/ur_client_library/control/reverse_interface.h
index d1e5707..e06e723 100644
--- a/include/ur_client_library/control/reverse_interface.h
+++ b/include/ur_client_library/control/reverse_interface.h
@@ -34,8 +34,8 @@
#include "ur_client_library/types.h"
#include "ur_client_library/log.h"
#include <cstring>
-#include <endian.h>
#include <condition_variable>
+#include "ur_client_library/portable_endian.h"

namespace urcl
{
diff --git a/include/ur_client_library/primary/package_header.h b/include/ur_client_library/primary/package_header.h
index cd64bda..440b2e4 100644
--- a/include/ur_client_library/primary/package_header.h
+++ b/include/ur_client_library/primary/package_header.h
@@ -32,7 +32,7 @@

#include <inttypes.h>
#include <cstddef>
-#include <endian.h>
+#include "ur_client_library/portable_endian.h"
#include "ur_client_library/types.h"

namespace urcl
diff --git a/include/ur_client_library/rtde/package_header.h b/include/ur_client_library/rtde/package_header.h
index f910a08..eb509ea 100644
--- a/include/ur_client_library/rtde/package_header.h
+++ b/include/ur_client_library/rtde/package_header.h
@@ -31,7 +31,7 @@
#define UR_CLIENT_LIBRARY_RTDE__HEADER_H_INCLUDED

#include <cstddef>
-#include <endian.h>
+#include "ur_client_library/portable_endian.h"
#include "ur_client_library/types.h"
#include "ur_client_library/comm/package_serializer.h"

diff --git a/src/comm/tcp_socket.cpp b/src/comm/tcp_socket.cpp
index 586cb72..cee3961 100644
--- a/src/comm/tcp_socket.cpp
+++ b/src/comm/tcp_socket.cpp
@@ -21,11 +21,11 @@
*/

#include <arpa/inet.h>
-#include <endian.h>
#include <netinet/tcp.h>
#include <unistd.h>
#include <cstring>

+#include "ur_client_library/portable_endian.h"
#include "ur_client_library/log.h"
#include "ur_client_library/comm/tcp_socket.h"

@@ -45,7 +45,9 @@ void TCPSocket::setOptions(int socket_fd)
{
int flag = 1;
setsockopt(socket_fd, IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(int));
+#ifndef __APPLE__
setsockopt(socket_fd, IPPROTO_TCP, TCP_QUICKACK, &flag, sizeof(int));
+#endif

if (recv_timeout_ != nullptr)
{
Loading
Loading