Skip to content

Commit a225f38

Browse files
author
Kei
authored
Merge pull request #46 from ROBOTIS-GIT/hotfix-user_config_bug
Move user_config.h to library folder from sketch folder. and bug fix.
2 parents 4369004 + 53ed39c commit a225f38

File tree

20 files changed

+29
-114
lines changed

20 files changed

+29
-114
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ We plan to support only LTS version for ROS2.
1010

1111
|ros2arduino|ROS2|Micro-XRCE-DDS Agent|
1212
|:-:|:-:|:-:|
13-
|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)|
13+
|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)|
1414

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

2929
|ros2arduino|ROS2|Micro-XRCE-DDS Agent|
3030
|:-:|:-:|:-:|
31-
|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)|
31+
|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)|
3232
|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)|
3333
|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)|
3434
|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)|
@@ -81,7 +81,7 @@ You must install ROS2 and XRCE-DDS Agent. (The version should be the same as the
8181

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

84-
- 0.2.0 or above (Micro-XRCE-DDS-Agent 1.3.0)
84+
- 0.2.1 or above (Micro-XRCE-DDS-Agent 1.3.0)
8585
- Serial
8686
```bash
8787
$ MicroXRCEAgent serial --dev /dev/ttyACM0 -b 115200
@@ -134,8 +134,6 @@ $ ros2 topic echo /arduino_chatter
134134
```cpp
135135
#define UXR_CREATE_ENTITIES_USING_REF 1
136136
```
137-
- ros2arduino 0.2.0 or above.
138-
- 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))
139137
- ros2arduino 0.1.1 ~ 0.1.4
140138
- 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))
141139

examples/publisher_ethernet_tcp/publisher_ethernet_tcp.ino

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "user_config.h" // It must be located above ros2arduino.h.
21
#include <ros2arduino.h>
32

43
#include <Ethernet.h>

examples/publisher_ethernet_udp/publisher_ethernet_udp.ino

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "user_config.h" // It must be located above ros2arduino.h.
21
#include <ros2arduino.h>
32

43
#include <Ethernet.h>

examples/publisher_ethernet_udp/user_config.h

Lines changed: 0 additions & 25 deletions
This file was deleted.

examples/publisher_wifi_tcp/publisher_wifi_tcp.ino

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "user_config.h" // It must be located above ros2arduino.h.
21
#include <ros2arduino.h>
32

43
#include <WiFi.h>

examples/publisher_wifi_tcp/user_config.h

Lines changed: 0 additions & 25 deletions
This file was deleted.

examples/publisher_wifi_udp/publisher_wifi_udp.ino

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "user_config.h" // It must be located above ros2arduino.h.
21
#include <ros2arduino.h>
32

43
#include <WiFi.h>

examples/subscriber/subscriber.ino

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "user_config.h" // It must be located above ros2arduino.h.
21
#include <ros2arduino.h>
32

43
#ifndef LED_BUILTIN // To support some boards (eg. some esp32 boards)

examples/subscriber/user_config.h

Lines changed: 0 additions & 25 deletions
This file was deleted.

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=ros2arduino
2-
version=0.2.0
2+
version=0.2.1
33
author=ROBOTIS
44
license=Apache-2.0
55
maintainer=Kei([email protected])

src/ros2/topic.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#include <stdlib.h>
1212
#include "xrcedds/xrcedds.hpp"
13-
#include "xrcedds/micro_xrce_dds/micro_xrce_dds.h"
1413
#include "topic_id_number.h"
1514

1615
namespace ros2 {

src/ros2/xrcedds/xrcedds.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212

1313
//-- Internal Variables for UXR
1414
//
15-
#include "micro_xrce_dds/micro_xrce_dds.h"
16-
17-
1815
#ifdef UXR_CREATE_BUFFER_BEST_EFFORT
1916
#define BUFFER_SIZE 4096
2017
static uint8_t output_best_effort_stream_buffer[BUFFER_SIZE * UXR_CONFIG_MAX_OUTPUT_BEST_EFFORT_STREAMS];

src/ros2/xrcedds/xrcedds.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#define XRCEDDS_HPP_
1010

1111
#include <stdint.h>
12+
#include "micro_xrce_dds/micro_xrce_dds.h"
1213

1314
namespace xrcedds {
1415

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef SKETCH_USER_CONFIG_H_
2-
#define SKETCH_USER_CONFIG_H_
1+
#ifndef ROS2ARDUINO_USER_CONFIG_H_
2+
#define ROS2ARDUINO_USER_CONFIG_H_
33

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

1313
// Select only one communication method you wish to use.
14-
// options: USER_TRANSPORT_TYPE_UDP, USER_TRANSPORT_TYPE_TCP, USER_TRANSPORT_TYPE_SERIAL
15-
#define USER_TRANSPORT_TYPE USER_TRANSPORT_TYPE_TCP
14+
// options: UDP: 0
15+
// TCP: 1
16+
// SERIAL: 2
17+
// #define USER_TRANSPORT_TYPE 0
1618

1719
// Set the MTU of the transport.
1820
#define USER_TRANSPORT_MTU 2048
1921

2022
// Set the maximum number of Pub/Subs to be created on the node.
21-
#define USER_ROS2_PUBLISHER_MAX 5
22-
#define USER_ROS2_SUBSCRIBER_MAX 5
23+
#define USER_ROS2_PUBLISHER_MAX 10
24+
#define USER_ROS2_SUBSCRIBER_MAX 10
2325

2426

25-
#endif /* SKETCH_USER_CONFIG_H_ */
27+
#endif /* ROS2ARDUINO_USER_CONFIG_H_ */

src/uxr/client/config.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,33 @@
1515
#ifndef _UXR_CLIENT_CONFIG_H_
1616
#define _UXR_CLIENT_CONFIG_H_
1717

18+
#include <user_config.h>
19+
20+
#define USER_TRANSPORT_TYPE_UDP 0
21+
#define USER_TRANSPORT_TYPE_TCP 1
22+
#define USER_TRANSPORT_TYPE_SERIAL 2
1823

1924
#define UXR_CLIENT_VERSION_MAJOR 1
2025
#define UXR_CLIENT_VERSION_MINOR 2
2126
#define UXR_CLIENT_VERSION_MICRO 1
2227
#define UXR_CLIENT_VERSION_STR "1.2.1"
2328

2429
// related to user definition in sketch file (.ino)
25-
#if defined(USER_TRANSPORT_TYPE) && (USER_TRANSPORT_TYPE == USER_TRANSPORT_TYPE_UDP)
30+
#if defined(USER_TRANSPORT_TYPE)
31+
#if (USER_TRANSPORT_TYPE == USER_TRANSPORT_TYPE_UDP)
2632
#define PROFILE_UDP_TRANSPORT
27-
#elif defined(USER_TRANSPORT_TYPE) && (USER_TRANSPORT_TYPE == USER_TRANSPORT_TYPE_TCP)
33+
#elif (USER_TRANSPORT_TYPE == USER_TRANSPORT_TYPE_TCP)
2834
#define PROFILE_TCP_TRANSPORT
29-
#elif defined(USER_TRANSPORT_TYPE) && (USER_TRANSPORT_TYPE == USER_TRANSPORT_TYPE_SERIAL)
35+
#elif (USER_TRANSPORT_TYPE == USER_TRANSPORT_TYPE_SERIAL)
3036
#define PROFILE_SERIAL_TRANSPORT
37+
#else
38+
#error "Please enter a valid transport number (USER_TRANSPORT_TYPE, refer to user_config.h in examples.)"
39+
#endif
3140
#else //To support legacy
3241
#define PROFILE_UDP_TRANSPORT
3342
#define PROFILE_TCP_TRANSPORT
3443
#define PROFILE_SERIAL_TRANSPORT
35-
#endif
44+
#endif /* USER_TRANSPORT_TYPE */
3645

3746
#if !defined(USER_ROS2_PUBLISHER_MAX)
3847
#define USER_ROS2_PUBLISHER_MAX 5

src/uxr/client/profile/transport/ip/tcp/tcp_transport_arduino.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ bool uxr_init_tcp_platform(struct uxrTCPPlatform* platform, uxrIpProtocol ip_pro
1111
if(ip_protocol != UXR_IPv4){
1212
return false;
1313
}
14-
return uxr_connectTcpArduino(platform->client_instance, ip, (uint16_t)strtol(port, str_ptr, 10));
14+
return uxr_connectTcpArduino(platform->client_instance, ip, (uint16_t)strtol(port, &str_ptr, 10));
1515
}
1616

1717
bool uxr_close_tcp_platform(struct uxrTCPPlatform* platform)

src/uxr/client/profile/transport/ip/tcp/tcp_transport_external.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
#include <uxr/client/config.h>
55

6-
#if defined(UCLIENT_EXTERNAL_TCP)
7-
86
#ifdef __cplusplus
97
extern "C"
108
{
@@ -20,6 +18,4 @@ typedef struct uxrTCPPlatform
2018
}
2119
#endif
2220

23-
#endif //UCLIENT_EXTERNAL_TCP
24-
2521
#endif // UXR_CLIENT_PROFILE_TRANSPORT_IP_TCP_EXTERNAL_H_

src/uxr/client/profile/transport/ip/udp/udp_transport_arduino.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ bool uxr_init_udp_platform(struct uxrUDPPlatform* platform, uxrIpProtocol ip_pro
1111
if(ip_protocol != UXR_IPv4){
1212
return false;
1313
}
14-
return uxr_initUdpArduino(platform->udp_instance, ip, (uint16_t)strtol(port, str_ptr, 10));
14+
return uxr_initUdpArduino(platform->udp_instance, ip, (uint16_t)strtol(port, &str_ptr, 10));
1515
}
1616

1717
bool uxr_close_udp_platform(uxrUDPPlatform* platform)

src/uxr/client/profile/transport/ip/udp/udp_transport_external.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
#include <uxr/client/config.h>
55

6-
#if defined(UCLIENT_EXTERNAL_UDP)
7-
86
#ifdef __cplusplus
97
extern "C"
108
{
@@ -21,6 +19,4 @@ typedef struct uxrUDPPlatform
2119
}
2220
#endif
2321

24-
#endif //UCLIENT_EXTERNAL_UDP
25-
2622
#endif // UXR_CLIENT_PROFILE_TRANSPORT_IP_UDP_EXTERNAL_H_

src/uxr/client/profile/transport/serial/serial_transport_external.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#define UXR_CLIENT_PROFILE_TRANSPORT_SERIAL_EXTERNAL_H_
33

44
#include <uxr/client/config.h>
5-
#if defined(UCLIENT_EXTERNAL_SERIAL)
65

76
#ifdef __cplusplus
87
extern "C"
@@ -21,6 +20,4 @@ typedef struct uxrSerialPlatform
2120
}
2221
#endif
2322

24-
#endif //UCLIENT_EXTERNAL_SERIAL
25-
2623
#endif // UXR_CLIENT_PROFILE_TRANSPORT_SERIAL_EXTERNAL_H_

0 commit comments

Comments
 (0)