PLCProcess.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef __PLC_PROCESS__HH__
  2. #define __PLC_PROCESS__HH__
  3. #include <tf/tf.h>
  4. #include "tf2_msgs/TFMessage.h"
  5. #include <Eigen/Core>
  6. #include <Eigen/Dense>
  7. #include <string>
  8. #include <boost/foreach.hpp>
  9. #include <boost/thread.hpp>
  10. #include <vector>
  11. #include <math.h>
  12. #include "PLCModbus.h"
  13. class PLCProcess
  14. {
  15. public:
  16. PLCProcess();
  17. ~PLCProcess();
  18. void Update(std::vector<std::vector<tf::Transform>> trajectorys);
  19. struct TRAJECTORY
  20. {
  21. std::vector<std::vector<tf::Transform>> left_trajectorys_;
  22. std::vector<std::vector<tf::Transform>> right_trajectorys_;
  23. bool bUpdate;
  24. };
  25. protected:
  26. bool split_trajectorys(std::vector<std::vector<tf::Transform>> trajectorys);
  27. bool send_trajectory(std::vector<tf::Transform> trajectory_l,std::vector<tf::Transform> trajectory_r);
  28. std::vector<uint16_t> absolute_convert_to_relative(std::vector<tf::Transform> tf_data);
  29. unsigned int get_node_index();
  30. static void thread_func_process(void *process);
  31. public:
  32. struct TRAJECTORY trajectory_;
  33. plc_modbus::CPLCModbus plc_;
  34. bool exit_;
  35. boost::thread* plc_process_thread_;
  36. boost::mutex mutex_trajectorys_;
  37. };
  38. #endif