2 #include <unordered_map> 9 #include <matlogger2/matlogger2.h> 10 #include <matlogger2/utils/mat_appender.h> 13 int main (
int argc,
char **argv ) {
15 ros::init ( argc, argv,
"EEHalExecutor" );
19 if ( ! nh.
getParam (
"/rosee/hal_library_name", hal_lib ) ) {
25 std::string matlogger_path;
26 XBot::MatLogger2::Ptr logger;
27 XBot::MatAppender::Ptr appender;
31 if ( nh.
getParam (
"/rosee/matlogger_path", matlogger_path ) && matlogger_path.size() != 0) {
32 ROS_INFO_STREAM(
"Logging data with matlogger into " << matlogger_path );
34 logger = XBot::MatLogger2::MakeLogger(matlogger_path);
35 appender = XBot::MatAppender::MakeInstance();
36 appender->add_logger(logger);
37 appender->start_flush_thread();
42 std::unique_ptr<ROSEE::EEHal> eeHalPtr = ROSEE::Utils::loadObject<ROSEE::EEHal>
43 (hal_lib,
"create_object_"+hal_lib, &nh);
45 if (eeHalPtr ==
nullptr) {
52 if (eeHalPtr->isHandInfoPresent()) {
53 eeHalPtr->init_hand_info_response();
54 eeHalPtr->setHandInfoCallback();
70 if (eeHalPtr->checkCommandPub()) {
72 ROS_WARN_STREAM_ONCE (
"[EEHalExecutor] someone is publishing on '/ros_end_effector/motor_reference_pos', I will call the move()" );
75 ROS_WARN_STREAM_THROTTLE (60,
"[EEHalExecutor] no-one is publishing on '/ros_end_effector/motor_reference_pos', I will not call the move()" );
79 eeHalPtr->publish_joint_state();
83 if (eeHalPtr->_pressure_active) {
84 eeHalPtr->publish_pressure();
89 logger->add(
"motor_pos_ref", eeHalPtr->getMotorReference());
90 logger->add(
"motor_pos", eeHalPtr->getJointPosition());
91 logger->add(
"motor_eff", eeHalPtr->getJointEffort());
92 auto pressures = eeHalPtr->getPressure();
93 logger->add(
"pressure1", pressures.row(0));
94 logger->add(
"pressure2", pressures.row(1));
95 logger->add(
"pressure3", pressures.row(2));
96 logger->add(
"pressure4", pressures.row(3));
#define ROS_WARN_STREAM_THROTTLE(period, args)
int main(int argc, char **argv)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool getParam(const std::string &key, std::string &s) const
#define ROS_INFO_STREAM(args)
#define ROS_WARN_STREAM_ONCE(args)
#define ROS_ERROR_STREAM(args)
ROSCPP_DECL void spinOnce()