
Hello, I've got problem with Dynamic reconfigure. I want to create bind function for DynamicGUI Class due to tutorial, but something is wrong. All Dynamic reconfigure functionality is in DynamicGUI Class.
DynamicGui.h
#include <gateway_sim/SimulationConfig.h> #include <dynamic_reconfigure/server.h> #ifndef DYNAMICGUI_H #define DYNAMICGUI_H class DynamicGUI { public: DynamicGUI(); ~DynamicGUI(); ethercat_gateway::DOutput GatewayOutput; ethercat_gateway::DAInput GatewayInput; dynamic_reconfigure::Server<gateway_sim::SimulationConfig> dParamServer; dynamic_reconfigure::Server<gateway_sim::SimulationConfig>::CallbackType f; void paramCb(gateway_sim::SimulationConfig &config, uint32_t level); }; #endif DynamicGui.cpp
#include <gateway_sim/DynamicGui.h> DynamicGUI::DynamicGUI() { f= boost::bind(&DynamicGUI::paramCb, _1, _2); dParamServer.setCallback(f); } void DynamicGUI::paramCb(gateway_sim::SimulationConfig &config, uint32_t level) { GatewayOutput.Output_value_Ch1 = config.Output_value_Ch1; GatewayOutput.Output_value_Ch2 = config.Output_value_Ch2; GatewayOutput.Output_value_Ch3 = config.Output_value_Ch3; GatewayOutput.Output_value_Ch4 = config.Output_value_Ch4; GatewayOutput.Output_value_Ch5 = config.Output_value_Ch5; GatewayOutput.Output_value_Ch6 = config.Output_value_Ch6; GatewayOutput.Output_value_Ch7 = config.Output_value_Ch7; GatewayOutput.Output_value_Ch8 = config.Output_value_Ch8; GatewayOutput.Output_value_Ch9 = config.Output_value_Ch9; GatewayOutput.Output_value_Ch10 = config.Output_value_Ch10; GatewayOutput.Output_value_Ch11 = config.Output_value_Ch11; GatewayOutput.Output_value_Ch12 = config.Output_value_Ch12; GatewayOutput.Output_value_Ch13 = config.Output_value_Ch13; GatewayOutput.Output_value_Ch14 = config.Output_value_Ch14; GatewayOutput.Output_value_Ch15 = config.Output_value_Ch15; GatewayOutput.Output_value_Ch16 = config.Output_value_Ch16; } The Class is created in ControlNode node.
#include <gateway_sim/ControlNode.h> #include<gateway_sim/DynamicGui.h> #include <signal.h> ControlNode::ControlNode() : TurckIO (nh), Motor1(nh,"s1"), Motor2 (nh, "s2") { DynamicGUI Reconfigurate(); ControlDataTimer = nh.createTimer(ros::Duration(0.01), &ControlNode::timerCallback, this); ControlDataTimer1s = nh.createTimer(ros::Duration(1), &ControlNode::timerCallback1s, this); } I receive error:
In file included from /usr/include/boost/bind.hpp:22, from /opt/ros/noetic/include/ros/publisher.h:35, from /opt/ros/noetic/include/ros/node_handle.h:32, from /opt/ros/noetic/include/ros/ros.h:45, from /home/kamil/catkin_ws/src/gateway_sim/include/gateway_sim/ControlNode.h:11, from /home/kamil/catkin_ws/src/gateway_sim/include/gateway_sim/DynamicGui.h:2, from /home/kamil/catkin_ws/src/gateway_sim/src/DynamicGui.cpp:1: /usr/include/boost/bind/bind.hpp: In instantiation of ‘struct boost::_bi::result_traits<boost::_bi::unspecified, void (DynamicGUI::*)(gateway_sim::SimulationConfig&, unsigned int)>’: /usr/include/boost/bind/bind.hpp:1284:48: required from ‘class boost::_bi::bind_t<boost::_bi::unspecified, void (DynamicGUI::*)(gateway_sim::SimulationConfig&, unsigned int), boost::_bi::list2<boost::_bi::value<DynamicGUI*>, boost::arg<1> > >’ /home/kamil/catkin_ws/src/gateway_sim/src/DynamicGui.cpp:7:50: required from here /usr/include/boost/bind/bind.hpp:75:37: error: ‘void (DynamicGUI::*)(gateway_sim::SimulationConfig&, unsigned int)’ is not a class, struct, or union type 75 | typedef typename F::result_type type; | ^~~~ In file included from /usr/include/boost/function/detail/maybe_include.hpp:29, from /usr/include/boost/function/detail/function_iterate.hpp:14, from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:58, from /usr/include/boost/function.hpp:71, from /opt/ros/noetic/include/ros/forwards.h:40, from /opt/ros/noetic/include/ros/common.h:37, from /opt/ros/noetic/include/ros/ros.h:43, from /home/kamil/catkin_ws/src/gateway_sim/include/gateway_sim/ControlNode.h:11, from /home/kamil/catkin_ws/src/gateway_sim/include/gateway_sim/DynamicGui.h:2, from /home/kamil/catkin_ws/src/gateway_sim/src/DynamicGui.cpp:1: /usr/include/boost/function/function_template.hpp: In instantiation of ‘static void boost::detail::function::void_function_obj_invoker2<FunctionObj, R, T0, T1>::invoke(boost::detail::function::function_buffer&, T0, T1) [with FunctionObj = boost::_bi::bind_t<boost::_bi::unspecified, void (DynamicGUI::*)(gateway_sim::SimulationConfig&, unsigned int), boost::_bi::list2<boost::_bi::value<DynamicGUI*>, boost::arg<1> > >; R = void; T0 = gateway_sim::SimulationConfig&; T1 = unsigned int]’: /usr/include/boost/function/function_template.hpp:931:38: required from ‘void boost::function2<R, T1, T2>::assign_to(Functor) [with Functor = boost::_bi::bind_t<boost::_bi::unspecified, void (DynamicGUI::*)(gateway_sim::SimulationConfig&, unsigned int), boost::_bi::list2<boost::_bi::value<DynamicGUI*>, boost::arg<1> > >; R = void; T0 = gateway_sim::SimulationConfig&; T1 = unsigned int]’ /usr/include/boost/function/function_template.hpp:720:7: required from ‘boost::function2<R, T1, T2>::function2(Functor, typename boost::enable_if_<(! boost::is_integral<Functor>::value), int>::type) [with Functor = boost::_bi::bind_t<boost::_bi::unspecified, void (DynamicGUI::*)(gateway_sim::SimulationConfig&, unsigned int), boost::_bi::list2<boost::_bi::value<DynamicGUI*>, boost::arg<1> > >; R = void; T0 = gateway_sim::SimulationConfig&; T1 = unsigned int; typename boost::enable_if_<(! boost::is_integral<Functor>::value), int>::type = int]’ /usr/include/boost/function/function_template.hpp:1068:16: required from ‘boost::function<R(T0, T1)>::function(Functor, typename boost::enable_if_<(! boost::is_integral<Functor>::value), int>::type) [with Functor = boost::_bi::bind_t<boost::_bi::unspecified, void (DynamicGUI::*)(gateway_sim::SimulationConfig&, unsigned int), boost::_bi::list2<boost::_bi::value<DynamicGUI*>, boost::arg<1> > >; R = void; T0 = gateway_sim::SimulationConfig&; T1 = unsigned int; typename boost::enable_if_<(! boost::is_integral<Functor>::value), int>::type = int]’ /usr/include/boost/function/function_template.hpp:1121:5: required from ‘typename boost::enable_if_<(! boost::is_integral<Functor>::value), boost::function<R(T0, T1)>&>::type boost::function<R(T0, T1)>::operator=(Functor) [with Functor = boost::_bi::bind_t<boost::_bi::unspecified, void (DynamicGUI::*)(gateway_sim::SimulationConfig&, unsigned int), boost::_bi::list2<boost::_bi::value<DynamicGUI*>, boost::arg<1> > >; R = void; T0 = gateway_sim::SimulationConfig&; T1 = unsigned int; typename boost::enable_if_<(! boost::is_integral<Functor>::value), boost::function<R(T0, T1)>&>::type = boost::function<void(gateway_sim::SimulationConfig&, unsigned int)>&]’ /home/kamil/catkin_ws/src/gateway_sim/src/DynamicGui.cpp:7:50: required from here /usr/include/boost/function/function_template.hpp:158:11: error: no match for call to ‘(boost::_bi::bind_t<boost::_bi::unspecified, void (DynamicGUI::*)(gateway_sim::SimulationConfig&, unsigned int), boost::_bi::list2<boost::_bi::value<DynamicGUI*>, boost::arg<1> > >) (gateway_sim::SimulationConfig&, unsigned int)’ 158 | BOOST_FUNCTION_RETURN((*f)(BOOST_FUNCTION_ARGS)); | ^~~~~~~~~~~~~~~~~~~~~ make[2]: *** [gateway_sim/CMakeFiles/simulation_node.dir/build.make:128: gateway_sim/CMakeFiles/simulation_node.dir/src/DynamicGui.cpp.o] Error 1 make[2]: *** Waiting for unfinished jobs.... make[1]: *** [CMakeFiles/Makefile2:1693: gateway_sim/CMakeFiles/simulation_node.dir/all] Error 2 make: *** [Makefile:141: all] Error 2 I have no idea what should be done to make it correct.
Originally posted by kamiln497 on ROS Answers with karma: 16 on 2022-03-27
Post score: 0