ur_realtime_communication.h
Go to the documentation of this file.
00001 /*
00002  * ur_realtime_communication.h
00003  *
00004  * Copyright 2015 Thomas Timm Andersen
00005  *
00006  * Licensed under the Apache License, Version 2.0 (the "License");
00007  * you may not use this file except in compliance with the License.
00008  * You may obtain a copy of the License at
00009  *
00010  *     http://www.apache.org/licenses/LICENSE-2.0
00011  *
00012  * Unless required by applicable law or agreed to in writing, software
00013  * distributed under the License is distributed on an "AS IS" BASIS,
00014  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015  * See the License for the specific language governing permissions and
00016  * limitations under the License.
00017  */
00018 
00019 #ifndef UR_REALTIME_COMMUNICATION_H_
00020 #define UR_REALTIME_COMMUNICATION_H_
00021 
00022 #include "robot_state_RT.h"
00023 #include "do_output.h"
00024 #include <vector>
00025 #include <stdlib.h>
00026 #include <stdio.h>
00027 #include <string.h>
00028 #include <sys/time.h>
00029 #include <thread>
00030 #include <mutex>
00031 #include <condition_variable>
00032 #include <sys/types.h>
00033 #include <sys/socket.h>
00034 #include <netinet/in.h>
00035 #include <netinet/tcp.h>
00036 #include <netdb.h>
00037 #include <iostream>
00038 #include <unistd.h>
00039 #include <arpa/inet.h>
00040 #include <errno.h>
00041 #include <fcntl.h>
00042 #include <sys/types.h>
00043 
00044 class UrRealtimeCommunication {
00045 private:
00046         unsigned int safety_count_max_;
00047         int sockfd_;
00048         struct sockaddr_in serv_addr_;
00049         struct hostent *server_;
00050         std::string local_ip_;
00051         bool keepalive_;
00052         std::thread comThread_;
00053         int flag_;
00054         std::recursive_mutex command_string_lock_;
00055         std::string command_;
00056         unsigned int safety_count_;
00057         void run();
00058 
00059 
00060 public:
00061         bool connected_;
00062         RobotStateRT* robot_state_;
00063 
00064         UrRealtimeCommunication(std::condition_variable& msg_cond, std::string host,
00065                         unsigned int safety_count_max = 12);
00066         bool start();
00067         void halt();
00068         void setSpeed(double q0, double q1, double q2, double q3, double q4,
00069                         double q5, double acc = 100.);
00070         void addCommandToQueue(std::string inp);
00071         void setSafetyCountMax(uint inp);
00072         std::string getLocalIp();
00073 
00074 };
00075 
00076 #endif /* UR_REALTIME_COMMUNICATION_H_ */


ur_modern_driver
Author(s): Thomas Timm Andersen
autogenerated on Wed Apr 3 2019 02:55:31