-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmodbustcp.h
39 lines (34 loc) · 1.08 KB
/
modbustcp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**************************************************
* This file is for modbus tcp
* Modified by xfyu on Jan 22
**************************************************/
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "main.h"
#include "modbusrtu.h"
#define ROBOT_ADDR "192.168.0.1" /* server addr */
#define MODBUS_PORT 502 /* server port */
#define REG_NUM 6 /* num of reg to read */
/* for realtime socket connection */
#define REALTIME_ADDR "192.168.0.1"
#define REALTIME_PORT 30003 /* real time client */
/**************************************************
* Function Definitions
**************************************************/
int connect_modbustcp();
int connect_realtime();
int read_pos(float * recv_value);
int read_wrist(float * recv_value);
void send_movel_instruct(float * desired_pose);
void send_movej_instruct(float * desired_joint);
float wait_until_nodiff(float *a1, float *a2);