Skip to content

Commit

Permalink
fix signed converison or potential loss of data warnings
Browse files Browse the repository at this point in the history
Signed-off-by: William Woodall <william@osrfoundation.org>
  • Loading branch information
wjwwood committed Jul 23, 2021
1 parent f901427 commit 23982cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions rclcpp/wait_set/include/wait_set/random_talker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
#ifndef WAIT_SET__RANDOM_TALKER_HPP_
#define WAIT_SET__RANDOM_TALKER_HPP_

#include <vector>
#include <cstdlib>
#include <random>
#include <vector>

#include "rclcpp/rclcpp.hpp"
#include "std_msgs/msg/string.hpp"
Expand All @@ -29,7 +30,9 @@ class RandomTalker : public rclcpp::Node
pub1_(this->create_publisher<std_msgs::msg::String>("topicA", 10)),
pub2_(this->create_publisher<std_msgs::msg::String>("topicB", 10)),
pub3_(this->create_publisher<std_msgs::msg::String>("topicC", 10)),
rand_engine_(std::chrono::system_clock::now().time_since_epoch().count())
rand_engine_(static_cast<std::default_random_engine::result_type>(
std::abs(std::chrono::system_clock::now().time_since_epoch().count())
))
{
publish_functions_.emplace_back(
([this]() {
Expand Down
4 changes: 2 additions & 2 deletions rclcpp/wait_set/src/wait_set_random_order.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ int32_t main(const int32_t argc, char ** const argv)
if (sub1_has_data && sub2_has_data && sub3_has_data) {
std_msgs::msg::String msg;
rclcpp::MessageInfo msg_info;
const int subscriptions_num = wait_set.get_rcl_wait_set().size_of_subscriptions;
for (int i = 0; i < subscriptions_num; i++) {
const size_t subscriptions_num = wait_set.get_rcl_wait_set().size_of_subscriptions;
for (size_t i = 0; i < subscriptions_num; i++) {
if (wait_result.get_wait_set().get_rcl_wait_set().subscriptions[i]) {
if (subscriptions.at(i)->take(msg, msg_info)) {
std::shared_ptr<void> type_erased_msg = std::make_shared<std_msgs::msg::String>(msg);
Expand Down

0 comments on commit 23982cc

Please sign in to comment.