Skip to content

Commit

Permalink
add message with constant values for all primitive types
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-thomas committed Aug 25, 2014
1 parent f2b8af2 commit e1f8cc0
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
1 change: 1 addition & 0 deletions simple_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ find_package(rosidl_default_generators REQUIRED)

rosidl_generate_interfaces(${PROJECT_NAME}
"msg/AllDynamicArrayTypes.msg"
"msg/AllPrimitiveConstants.msg"
"msg/AllPrimitiveTypes.msg"
"msg/AllStaticArrayTypes.msg"
"msg/Int32.msg"
Expand Down
14 changes: 14 additions & 0 deletions simple_msgs/msg/AllPrimitiveConstants.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
bool MY_BOOL=1
byte MY_BYTE=42
char MY_CHAR=43
float32 MY_FLOAT32=3.14
float64 MY_FLOAT64=3.1415
int8 MY_INT8=-128
uint8 MY_UINT8=255
int16 MY_INT16=-32768
uint16 MY_UINT16=65535
int32 MY_INT32=5
uint32 MY_UINT32=6
int64 MY_INT64=7
uint64 MY_UINT64=8
string MY_STRING=' f o o '
8 changes: 4 additions & 4 deletions simple_msgs/msg/AllStaticArrayTypes.msg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
bool[6] my_bool
byte[6] my_byte
bool[6] my_bool [0,1,0,1,0,1]
byte[6] my_byte [ 1 , 0 , 1 , 0 , 1 ,0]
char[6] my_char
float32[6] my_float32
float32[6] my_float32 [1.2,3.4,5.6,7.8,9.0,0.1]
float64[6] my_float64
int8[6] my_int8
uint8[6] my_uint8
Expand All @@ -11,4 +11,4 @@ int32[6] my_int32
uint32[6] my_uint32
int64[6] my_int64
uint64[6] my_uint64
string[6] my_string
string<=2[6] my_string
3 changes: 2 additions & 1 deletion simple_msgs/msg/String.msg
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
string data
string<=1000 data
string<=1000 data2
3 changes: 2 additions & 1 deletion userland/src/publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ int publish(rclcpp::Node* node, void (*set_data_func)(T&, uint32_t))
std::cout << "published ros msg #" << i << std::endl;
// }
++i;
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
auto end = std::chrono::steady_clock::now();

Expand Down Expand Up @@ -134,6 +134,7 @@ void set_nested(simple_msgs::Nested& ros_msg, uint32_t i)

void set_string(simple_msgs::String& ros_msg, uint32_t i)
{
i = pow(2, i) - 1;
ros_msg.data = "";
for (uint64_t j = i; j < 2 * i; ++j) {
ros_msg.data += std::to_string(j % 10);
Expand Down

0 comments on commit e1f8cc0

Please sign in to comment.