1 #ifndef KINEMATICS_RV2AJ_DRIVER_HPP     2 #define KINEMATICS_RV2AJ_DRIVER_HPP     5 #include "HLR/RV2AJDriverClear.h"     6 #include "HLR/RV2AJDriverContinue.h"     7 #include "HLR/RV2AJDriverPause.h"     8 #include "HLR/RV2AJDriverQueueAdd.h"     9 #include "HLR/RV2AJDriverQueueCount.h"    10 #include "std_msgs/String.h"    11 #include "std_msgs/UInt64.h"    14 #include <condition_variable>    40            const std::optional<std::string>& serial_path = std::nullopt,
    78     bool cont(HLR::RV2AJDriverContinue::Request& req,
    79               HLR::RV2AJDriverContinue::Response& res);
    87     bool pause(HLR::RV2AJDriverPause::Request& req,
    88                HLR::RV2AJDriverPause::Response& res);
    96     bool clear(HLR::RV2AJDriverClear::Request& req,
    97                HLR::RV2AJDriverClear::Response& res);
   105     bool queue_count(HLR::RV2AJDriverQueueCount::Request& req,
   106                      HLR::RV2AJDriverQueueCount::Response& res);
   114     bool queue_add(HLR::RV2AJDriverQueueAdd::Request& req,
   115                    HLR::RV2AJDriverQueueAdd::Response& res);
   130         std::array<std::string, 3> to_mb4() 
const;
   172     void tx(
const Command& cmd);
   179     void tx(
const std::string& mb4);
   191     void rx_sub_callback(
const std_msgs::String::ConstPtr& msg);
   203     std::size_t device_count = 0;
   215     ros::Publisher tx_pub;
   218     ros::Publisher tx_id_pub;
   221     bool tx_abort = 
false;
   224     std::mutex tx_abort_m;
   230     bool rx_block = 
true;
   233     std::mutex rx_block_m;
   236     std::condition_variable rx_block_cv;
   239     ros::Subscriber rx_sub;
   242     ros::ServiceServer srv_continue;
   245     ros::ServiceServer srv_pause;
   248     ros::ServiceServer srv_clear;
   251     ros::ServiceServer srv_queue_count;
   254     ros::ServiceServer srv_queue_add;
   260     State worker_state = State::cont;
   263     std::mutex worker_state_m;
   266     std::queue<Command> commands;
   269     std::mutex commands_m;
   272     std::condition_variable commands_cv;
   275     std::thread worker_reply;
   278     State worker_reply_state = State::cont;
   281     std::mutex worker_reply_state_m;
   284     std::queue<std::string> replies;
   287     std::mutex replies_m;
   290     std::condition_variable replies_cv;
 Driver for the Mitsubishi RV2-AJ. 
Definition: Driver.hpp:29
bool queue_add(HLR::RV2AJDriverQueueAdd::Request &req, HLR::RV2AJDriverQueueAdd::Response &res)
Add requested command to the queue if compliant. 
Driver(bool simulation, const std::optional< std::string > &serial_path=std::nullopt, bool debug=false)
Constructor. 
virtual ~Driver()
Destructor. 
OO wrapper around POSIX serial devices. 
Definition: Serial.hpp:14
bool pause(HLR::RV2AJDriverPause::Request &req, HLR::RV2AJDriverPause::Response &res)
Pause processing events in queue. 
bool clear(HLR::RV2AJDriverClear::Request &req, HLR::RV2AJDriverClear::Response &res)
Clears all to-be processed events in queue and stops current move. 
bool cont(HLR::RV2AJDriverContinue::Request &req, HLR::RV2AJDriverContinue::Response &res)
Continue processing events in queue. 
bool queue_count(HLR::RV2AJDriverQueueCount::Request &req, HLR::RV2AJDriverQueueCount::Response &res)
Returns the number of elements currently inside the queue. 
Driver & operator=(const Driver &d)=delete
Copy assignment operator, deleted.