1>C:\Asi\gluegun-ros2-windows\install\include\rclcpp/timer.hpp(174): error C2207: 'rclcpp::timer::GenericTimer<FunctorT,Clock,__formal>::callback_': a member of a class template cannot acquire a function type
1> C:\Asi\gluegun-ros2-windows\src\ros2\examples\rclcpp_examples\src\topics\talker.cpp(52): note: see reference to class template instantiation 'rclcpp::timer::GenericTimer<void (void),std::chrono::steady_clock,0x0>' being compiled
FunctorT* callback_;
#include <iostream>#include "rclcpp/rclcpp.hpp"#include "std_msgs/msg/string.hpp"void callback()
{
}int main(int argc, char * argv[])
{
rclcpp::init(argc, argv); auto node = rclcpp::node::Node::make_shared("talker"); rmw_qos_profile_t custom_qos_profile = rmw_qos_profile_default;
custom_qos_profile.depth = 7; auto chatter_pub = node->create_publisher<std_msgs::msg::String>("chatter", custom_qos_profile); rclcpp::WallRate loop_rate(2); auto msg = std::make_shared<std_msgs::msg::String>();
auto i = 1; while (rclcpp::ok()) {
msg->data = "Hello World: " + std::to_string(i++);
std::cout << "Publishing: '" << msg->data << "'" << std::endl;
chatter_pub->publish(msg);
rclcpp::spin_some(node);
loop_rate.sleep();
}
auto time = std::chrono::nanoseconds(1); rclcpp::WallTimer<void(void)>(time, callback);
return 0;
}
--
You received this message because you are subscribed to the Google Groups "ROS SIG NG ROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ros-sig-ng-ros+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
auto my_callback = std::bind(callback);
rclcpp::WallTime<std::function<void()>>(time,my_callback);
To unsubscribe from this group and stop receiving emails from it, send an email to ros-sig-ng-ro...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to ros-sig-ng-ros+unsubscribe@googlegroups.com.