39 #include <boost/chrono.hpp> 53 ROS_INFO(
"User pressed Ctrl+C Shutting down...");
55 diagnostic_loop.
stop();
57 ROS_INFO(
"Control and diagnostic loop stopped");
68 time_source::time_point &last_time)
71 time_source::time_point this_time = time_source::now();
72 boost::chrono::duration<double> elapsed_duration = this_time - last_time;
74 last_time = this_time;
92 int main(
int argc,
char **argv) {
101 double control_frequency, diagnostic_frequency;
102 private_nh.
param<
double>(
"control_frequency", control_frequency, 50.0);
103 private_nh.
param<
double>(
"diagnostic_frequency", diagnostic_frequency, 1.0);
104 ROS_INFO_STREAM(
"Control:" << control_frequency <<
"Hz - Diagnostic:" << diagnostic_frequency <<
"Hz");
106 string serial_port_string;
109 private_nh.
param<
string>(
"serial_port", serial_port_string,
"/dev/ttyACM0");
110 private_nh.
param<int32_t>(
"serial_rate", baud_rate, 115200);
111 ROS_INFO_STREAM(
"Open Serial " << serial_port_string <<
":" << baud_rate);
115 bool start = rSerial->
start();
134 time_source::time_point last_time = time_source::now();
137 boost::bind(
controlLoop, boost::ref(interface), boost::ref(cm), boost::ref(last_time)),
146 diagnostic_loop = nh.
createTimer(diagnostic_timer);
148 unav_spinner.
start();
151 ROS_INFO(
"Started %s", name_node.c_str());
void siginthandler(int param)
void read(const ros::Time &time, const ros::Duration &period)
boost::chrono::steady_clock time_source
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ROSCPP_DECL const std::string & getName()
void diagnosticLoop(roboteq::Roboteq &roboteq)
void write(const ros::Time &time, const ros::Duration &period)
ROSCPP_DECL void spin(Spinner &spinner)
void updateDiagnostics()
updateDiagnostics
ros::Timer diagnostic_loop
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
roboteq::serial_controller * rSerial
void controlLoop(roboteq::Roboteq &roboteq, controller_manager::ControllerManager &cm, time_source::time_point &last_time)
#define ROS_INFO_STREAM(args)
void initialize()
initialize the roboteq controller
ROSCPP_DECL void shutdown()
void initializeInterfaces(hardware_interface::JointStateInterface &joint_state_interface, hardware_interface::VelocityJointInterface &velocity_joint_interface)
initializeInterfaces Initialize all motors. Add all Control Interface availbles and add in diagnostic...
#define ROS_ERROR_STREAM(args)
void update(const ros::Time &time, const ros::Duration &period, bool reset_controllers=false)
int main(int argc, char **argv)
bool start()
start Initialize the serial communcation