35 inline static ros::NodeHandle *
m_pN = 0;
55 void init(
int argc,
char **argv,
double rate, std::string nodename)
58 ros::init(argc, argv, nodename);
59 ros::NodeHandle *n =
new ros::NodeHandle();
63 ros::NodeHandle np(
"~");
64 np.getParam(
"rate",
rate_);
77 m_pN, std::hash<std::string>{}(ros::this_node::getNamespace() + ros::this_node::getName()),
78 (uint32_t)(1e9 /
rate_));
105 inline static void func(std::function<
void()> &callback,
const ros::TimerEvent &te) { callback(); }
109 virtual void addTimerCallback(std::function<
void()> &callbackFcn,
double rate_factor = 1.0)
112 std::bind(&
func, callbackFcn, std::placeholders::_1)));
118 template <
typename T>
121 if (name.compare(0, 1,
"~") == 0)
123 ros::NodeHandle np(
"~");
124 return np.getParam(name.substr(1), val);
126 return m_pN->getParam(name, val);
131 template <
typename T>
132 bool getParam(
const std::string name, T &val,
const T &default_val)
134 return m_pN->param<T>(name, val, default_val);
virtual void addTimerCallback(std::function< void()> &callbackFcn, double rate_factor=1.0)
Definition: baseapp.h:109
void initSim()
Definition: baseapp.h:72
virtual void resume()
Definition: baseapp.h:90
virtual void run()
Definition: baseapp.h:98
bool getParam(const std::string name, T &val, const T &default_val)
Definition: baseapp.h:132
static adore_if_ros_scheduling::SchedulerNotificationManager * snm_
Definition: baseapp.h:37
bool getParam(const std::string name, T &val)
Definition: baseapp.h:119
double rate_
Definition: baseapp.h:40
static ros::NodeHandle * getRosNodeHandle()
Definition: baseapp.h:86
bool useScheduler_
Definition: baseapp.h:39
virtual void pause()
Definition: baseapp.h:94
std::vector< ros::Timer > timers_
Definition: baseapp.h:36
static void func(std::function< void()> &callback, const ros::TimerEvent &te)
Definition: baseapp.h:105
static void schedulerCallback(const ros::TimerEvent &e)
Definition: baseapp.h:47
Baseapp()
Definition: baseapp.h:32
void init(int argc, char **argv, double rate, std::string nodename)
Definition: baseapp.h:55
static ros::NodeHandle * m_pN
Definition: baseapp.h:35
Definition: schedulernotificationmanager.h:32
void resume() override
Definition: schedulernotificationmanager.h:75
void publishClientName(std::string name) override
Definition: schedulernotificationmanager.h:55
void notifyScheduler(uint32_t sec, uint32_t nsec) override
Definition: schedulernotificationmanager.h:66
void pause() override
Definition: schedulernotificationmanager.h:74
Definition: adore_if_ros_scheduling_constants.h:19
const char PARAM_NAME_USE_SCHEDULER[]
Definition: adore_if_ros_scheduling_constants.h:25