36 #include <boost/chrono.hpp> 45 time_source::time_point &last_time)
48 time_source::time_point this_time = time_source::now();
49 boost::chrono::duration<double> elapsed_duration = this_time - last_time;
51 last_time = this_time;
69 int main(
int argc,
char *argv[])
74 double control_frequency, diagnostic_frequency;
75 private_nh.
param<
double>(
"control_frequency", control_frequency, 10.0);
76 private_nh.
param<
double>(
"diagnostic_frequency", diagnostic_frequency, 1.0);
88 time_source::time_point last_time = time_source::now();
91 boost::bind(
controlLoop, boost::ref(roch), boost::ref(cm), boost::ref(last_time)),
100 roch_spinner.
start();
void diagnosticLoop(roch_base::rochHardware &roch)
void reportLoopDuration(const ros::Duration &duration)
int main(int argc, char *argv[])
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
void updateJointsFromHardware()
ROSCPP_DECL void spin(Spinner &spinner)
boost::chrono::steady_clock time_source
void controlLoop(roch_base::rochHardware &roch, controller_manager::ControllerManager &cm, time_source::time_point &last_time)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
Timer createTimer(Rate r, Handler h, Obj o, bool oneshot=false, bool autostart=true) const
void writeCommandsToHardware()
void update(const ros::Time &time, const ros::Duration &period, bool reset_controllers=false)