Skip to content

Commit

Permalink
Merge pull request #46 from ROBOTIS-GIT/hotfix-user_config_bug
Browse files Browse the repository at this point in the history
Move user_config.h to library folder from sketch folder. and bug fix.
  • Loading branch information
Kei authored May 26, 2020
2 parents 4369004 + 53ed39c commit a225f38
Show file tree
Hide file tree
Showing 20 changed files with 29 additions and 114 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ We plan to support only LTS version for ROS2.

|ros2arduino|ROS2|Micro-XRCE-DDS Agent|
|:-:|:-:|:-:|
|0.2.0|[Dashing Diademata Patch6](https://github.com/ros2/ros2/releases/tag/release-dashing-20200319)|[1.3.0](https://github.com/eProsima/Micro-XRCE-DDS-Agent/releases/tag/v1.3.0)|
|0.2.1|[Dashing Diademata Patch6](https://github.com/ros2/ros2/releases/tag/release-dashing-20200319)|[1.3.0](https://github.com/eProsima/Micro-XRCE-DDS-Agent/releases/tag/v1.3.0)|

For the Micro-XRCE-DDS Agent, please install it using following commands.
```bash
Expand All @@ -28,7 +28,7 @@ $ sudo ldconfig /usr/local/lib/

|ros2arduino|ROS2|Micro-XRCE-DDS Agent|
|:-:|:-:|:-:|
|0.2.0|[Dashing Diademata Patch6](https://github.com/ros2/ros2/releases/tag/release-dashing-20200319)|[1.3.0](https://github.com/eProsima/Micro-XRCE-DDS-Agent/releases/tag/v1.3.0)|
|0.2.1|[Dashing Diademata Patch6](https://github.com/ros2/ros2/releases/tag/release-dashing-20200319)|[1.3.0](https://github.com/eProsima/Micro-XRCE-DDS-Agent/releases/tag/v1.3.0)|
|0.1.4|[Dashing Diademata Patch3](https://github.com/ros2/ros2/releases/tag/release-dashing-20190910)|[1.1.0](https://github.com/eProsima/Micro-XRCE-DDS-Agent/releases/tag/v1.1.0)|
|0.1.3|[Dashing Diademata Patch3](https://github.com/ros2/ros2/releases/tag/release-dashing-20190910)|[1.1.0](https://github.com/eProsima/Micro-XRCE-DDS-Agent/releases/tag/v1.1.0)|
|0.1.2|[Dashing Diademata Patch1](https://github.com/ros2/ros2/releases/tag/release-dashing-20190614)|[1.1.0](https://github.com/eProsima/Micro-XRCE-DDS-Agent/releases/tag/v1.1.0)|
Expand Down Expand Up @@ -81,7 +81,7 @@ You must install ROS2 and XRCE-DDS Agent. (The version should be the same as the

- Please refer to [eProsima manual](https://micro-xrce-dds.readthedocs.io/en/latest/agent.html) for Micro-XRCE-DDS-Agent usage.

- 0.2.0 or above (Micro-XRCE-DDS-Agent 1.3.0)
- 0.2.1 or above (Micro-XRCE-DDS-Agent 1.3.0)
- Serial
```bash
$ MicroXRCEAgent serial --dev /dev/ttyACM0 -b 115200
Expand Down Expand Up @@ -134,8 +134,6 @@ $ ros2 topic echo /arduino_chatter
```cpp
#define UXR_CREATE_ENTITIES_USING_REF 1
```
- ros2arduino 0.2.0 or above.
- Set `UXR_CREATE_ENTITIES_USING_REF` to `1` in your sketch. (eg. [basic examples](https://github.com/ROBOTIS-GIT/ros2arduino/blob/master/examples/publisher/user_config.h))
- ros2arduino 0.1.1 ~ 0.1.4
- You need to change the settings(library code) in ros2arduino library. (In the [user_config.h](https://github.com/ROBOTIS-GIT/ros2arduino/blob/master/src/user_config.h))

Expand Down
1 change: 0 additions & 1 deletion examples/publisher_ethernet_tcp/publisher_ethernet_tcp.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "user_config.h" // It must be located above ros2arduino.h.
#include <ros2arduino.h>

#include <Ethernet.h>
Expand Down
1 change: 0 additions & 1 deletion examples/publisher_ethernet_udp/publisher_ethernet_udp.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "user_config.h" // It must be located above ros2arduino.h.
#include <ros2arduino.h>

#include <Ethernet.h>
Expand Down
25 changes: 0 additions & 25 deletions examples/publisher_ethernet_udp/user_config.h

This file was deleted.

1 change: 0 additions & 1 deletion examples/publisher_wifi_tcp/publisher_wifi_tcp.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "user_config.h" // It must be located above ros2arduino.h.
#include <ros2arduino.h>

#include <WiFi.h>
Expand Down
25 changes: 0 additions & 25 deletions examples/publisher_wifi_tcp/user_config.h

This file was deleted.

1 change: 0 additions & 1 deletion examples/publisher_wifi_udp/publisher_wifi_udp.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "user_config.h" // It must be located above ros2arduino.h.
#include <ros2arduino.h>

#include <WiFi.h>
Expand Down
1 change: 0 additions & 1 deletion examples/subscriber/subscriber.ino
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "user_config.h" // It must be located above ros2arduino.h.
#include <ros2arduino.h>

#ifndef LED_BUILTIN // To support some boards (eg. some esp32 boards)
Expand Down
25 changes: 0 additions & 25 deletions examples/subscriber/user_config.h

This file was deleted.

2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ros2arduino
version=0.2.0
version=0.2.1
author=ROBOTIS
license=Apache-2.0
maintainer=Kei([email protected])
Expand Down
1 change: 0 additions & 1 deletion src/ros2/topic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#include <stdlib.h>
#include "xrcedds/xrcedds.hpp"
#include "xrcedds/micro_xrce_dds/micro_xrce_dds.h"
#include "topic_id_number.h"

namespace ros2 {
Expand Down
3 changes: 0 additions & 3 deletions src/ros2/xrcedds/xrcedds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

//-- Internal Variables for UXR
//
#include "micro_xrce_dds/micro_xrce_dds.h"


#ifdef UXR_CREATE_BUFFER_BEST_EFFORT
#define BUFFER_SIZE 4096
static uint8_t output_best_effort_stream_buffer[BUFFER_SIZE * UXR_CONFIG_MAX_OUTPUT_BEST_EFFORT_STREAMS];
Expand Down
1 change: 1 addition & 0 deletions src/ros2/xrcedds/xrcedds.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define XRCEDDS_HPP_

#include <stdint.h>
#include "micro_xrce_dds/micro_xrce_dds.h"

namespace xrcedds {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef SKETCH_USER_CONFIG_H_
#define SKETCH_USER_CONFIG_H_
#ifndef ROS2ARDUINO_USER_CONFIG_H_
#define ROS2ARDUINO_USER_CONFIG_H_

/**
* Select to enable eProsima's Micro-XRCE-DDS reference function.
Expand All @@ -11,15 +11,17 @@
/* The options below are needed to reduce the usage of static memory */

// Select only one communication method you wish to use.
// options: USER_TRANSPORT_TYPE_UDP, USER_TRANSPORT_TYPE_TCP, USER_TRANSPORT_TYPE_SERIAL
#define USER_TRANSPORT_TYPE USER_TRANSPORT_TYPE_TCP
// options: UDP: 0
// TCP: 1
// SERIAL: 2
// #define USER_TRANSPORT_TYPE 0

// Set the MTU of the transport.
#define USER_TRANSPORT_MTU 2048

// Set the maximum number of Pub/Subs to be created on the node.
#define USER_ROS2_PUBLISHER_MAX 5
#define USER_ROS2_SUBSCRIBER_MAX 5
#define USER_ROS2_PUBLISHER_MAX 10
#define USER_ROS2_SUBSCRIBER_MAX 10


#endif /* SKETCH_USER_CONFIG_H_ */
#endif /* ROS2ARDUINO_USER_CONFIG_H_ */
17 changes: 13 additions & 4 deletions src/uxr/client/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,33 @@
#ifndef _UXR_CLIENT_CONFIG_H_
#define _UXR_CLIENT_CONFIG_H_

#include <user_config.h>

#define USER_TRANSPORT_TYPE_UDP 0
#define USER_TRANSPORT_TYPE_TCP 1
#define USER_TRANSPORT_TYPE_SERIAL 2

#define UXR_CLIENT_VERSION_MAJOR 1
#define UXR_CLIENT_VERSION_MINOR 2
#define UXR_CLIENT_VERSION_MICRO 1
#define UXR_CLIENT_VERSION_STR "1.2.1"

// related to user definition in sketch file (.ino)
#if defined(USER_TRANSPORT_TYPE) && (USER_TRANSPORT_TYPE == USER_TRANSPORT_TYPE_UDP)
#if defined(USER_TRANSPORT_TYPE)
#if (USER_TRANSPORT_TYPE == USER_TRANSPORT_TYPE_UDP)
#define PROFILE_UDP_TRANSPORT
#elif defined(USER_TRANSPORT_TYPE) && (USER_TRANSPORT_TYPE == USER_TRANSPORT_TYPE_TCP)
#elif (USER_TRANSPORT_TYPE == USER_TRANSPORT_TYPE_TCP)
#define PROFILE_TCP_TRANSPORT
#elif defined(USER_TRANSPORT_TYPE) && (USER_TRANSPORT_TYPE == USER_TRANSPORT_TYPE_SERIAL)
#elif (USER_TRANSPORT_TYPE == USER_TRANSPORT_TYPE_SERIAL)
#define PROFILE_SERIAL_TRANSPORT
#else
#error "Please enter a valid transport number (USER_TRANSPORT_TYPE, refer to user_config.h in examples.)"
#endif
#else //To support legacy
#define PROFILE_UDP_TRANSPORT
#define PROFILE_TCP_TRANSPORT
#define PROFILE_SERIAL_TRANSPORT
#endif
#endif /* USER_TRANSPORT_TYPE */

#if !defined(USER_ROS2_PUBLISHER_MAX)
#define USER_ROS2_PUBLISHER_MAX 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ bool uxr_init_tcp_platform(struct uxrTCPPlatform* platform, uxrIpProtocol ip_pro
if(ip_protocol != UXR_IPv4){
return false;
}
return uxr_connectTcpArduino(platform->client_instance, ip, (uint16_t)strtol(port, str_ptr, 10));
return uxr_connectTcpArduino(platform->client_instance, ip, (uint16_t)strtol(port, &str_ptr, 10));
}

bool uxr_close_tcp_platform(struct uxrTCPPlatform* platform)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

#include <uxr/client/config.h>

#if defined(UCLIENT_EXTERNAL_TCP)

#ifdef __cplusplus
extern "C"
{
Expand All @@ -20,6 +18,4 @@ typedef struct uxrTCPPlatform
}
#endif

#endif //UCLIENT_EXTERNAL_TCP

#endif // UXR_CLIENT_PROFILE_TRANSPORT_IP_TCP_EXTERNAL_H_
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ bool uxr_init_udp_platform(struct uxrUDPPlatform* platform, uxrIpProtocol ip_pro
if(ip_protocol != UXR_IPv4){
return false;
}
return uxr_initUdpArduino(platform->udp_instance, ip, (uint16_t)strtol(port, str_ptr, 10));
return uxr_initUdpArduino(platform->udp_instance, ip, (uint16_t)strtol(port, &str_ptr, 10));
}

bool uxr_close_udp_platform(uxrUDPPlatform* platform)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

#include <uxr/client/config.h>

#if defined(UCLIENT_EXTERNAL_UDP)

#ifdef __cplusplus
extern "C"
{
Expand All @@ -21,6 +19,4 @@ typedef struct uxrUDPPlatform
}
#endif

#endif //UCLIENT_EXTERNAL_UDP

#endif // UXR_CLIENT_PROFILE_TRANSPORT_IP_UDP_EXTERNAL_H_
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define UXR_CLIENT_PROFILE_TRANSPORT_SERIAL_EXTERNAL_H_

#include <uxr/client/config.h>
#if defined(UCLIENT_EXTERNAL_SERIAL)

#ifdef __cplusplus
extern "C"
Expand All @@ -21,6 +20,4 @@ typedef struct uxrSerialPlatform
}
#endif

#endif //UCLIENT_EXTERNAL_SERIAL

#endif // UXR_CLIENT_PROFILE_TRANSPORT_SERIAL_EXTERNAL_H_

0 comments on commit a225f38

Please sign in to comment.