armadillo2_hw_node.cpp
Go to the documentation of this file.
1 
2 #include <ros/ros.h>
4 #include "armadillo2_hw.h"
5 
6 #define LOOP_HZ 100.0
7 #define THREADS_NUM 2
8 
9 int main(int argc, char **argv)
10 {
11  ros::init(argc, argv, "armadillo2_hw_node");
12  ros::NodeHandle nh;
13 
14  armadillo2_hw::ArmadilloHW armadillo_hw(nh);
16 
17  ros::AsyncSpinner asyncSpinner(THREADS_NUM);
18  asyncSpinner.start();
19 
20  ros::Time last_time = ros::Time::now();
21 
22  while (ros::ok())
23  {
24  armadillo_hw.read();
25 
26  ros::Duration(1.0 / (2.0 * LOOP_HZ)).sleep();
27 
28  ros::Duration duration = ros::Time::now() - last_time;
29  controller_manager.update(ros::Time::now(), duration);
30  last_time = ros::Time::now();
31 
32  armadillo_hw.write();
33 
34  ros::Duration(1.0 / (2.0 * LOOP_HZ)).sleep();
35 
37  }
38 }
bool sleep() const
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
#define LOOP_HZ
ROSCPP_DECL bool ok()
static Time now()
void update(const ros::Time &time, const ros::Duration &period, bool reset_controllers=false)
ROSCPP_DECL void spinOnce()
int main(int argc, char **argv)
#define THREADS_NUM


armadillo2_hw
Author(s):
autogenerated on Wed Jan 3 2018 03:48:27