Main Page
Namespaces
Classes
Files
File List
File Members
include
melfa_driver
melfa_hardware_interface.h
Go to the documentation of this file.
1
// Copyright 2018 Tokyo Opensource Robotics Kyokai Association (TORK)
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#include <unistd.h>
16
#include <sys/types.h>
17
#include <sys/socket.h>
18
#include <netinet/in.h>
19
#include <arpa/inet.h>
20
#include <
ros/ros.h
>
21
#include <
hardware_interface/joint_command_interface.h
>
22
#include <
hardware_interface/joint_state_interface.h
>
23
#include <
hardware_interface/robot_hw.h
>
24
#include <
diagnostic_updater/diagnostic_updater.h
>
25
#include "
melfa_driver/strdef.h
"
26
27
#define JOINT_NUM (8)
28
29
30
class
MelfaHW
:
public
hardware_interface::RobotHW
31
{
32
public
:
33
MelfaHW
(
double
period);
34
void
update
(
void
);
35
void
write
(
void
);
36
void
read
(
void
);
37
void
write_first
(
void
);
38
void
diagnose
(
diagnostic_updater::DiagnosticStatusWrapper
&stat);
39
40
inline
ros::Duration
getPeriod
()
41
{
42
return
ros::Duration
(
period_
);
43
}
44
private
:
45
double
period_
;
46
ros::Time
time_now_
;
47
ros::Time
time_old_
;
48
49
std::string
robot_ip_
;
50
int
socket_
;
51
struct
sockaddr_in
addr_
;
52
53
MXTCMD
send_buff_
;
54
MXTCMD
recv_buff_
;
55
int
counter_
;
56
57
// true if use joint7
58
bool
use_joint7_
;
59
// true if use joint8
60
bool
use_joint8_
;
61
// true if joint7 is linear joint
62
bool
joint7_is_linear_
;
63
// true if joint8 is linear joint
64
bool
joint8_is_linear_
;
65
66
hardware_interface::JointStateInterface
joint_state_interface
;
67
hardware_interface::PositionJointInterface
joint_pos_interface
;
68
69
double
cmd
[
JOINT_NUM
];
70
double
pos
[
JOINT_NUM
];
71
double
vel
[
JOINT_NUM
];
72
double
eff
[
JOINT_NUM
];
73
};
hardware_interface::JointStateInterface
MelfaHW::send_buff_
MXTCMD send_buff_
Definition:
melfa_hardware_interface.h:53
enet_rtcmd_str
Definition:
strdef.h:75
MelfaHW::pos
double pos[JOINT_NUM]
Definition:
melfa_hardware_interface.h:70
MelfaHW::cmd
double cmd[JOINT_NUM]
Definition:
melfa_hardware_interface.h:69
MelfaHW::vel
double vel[JOINT_NUM]
Definition:
melfa_hardware_interface.h:71
MelfaHW::joint_pos_interface
hardware_interface::PositionJointInterface joint_pos_interface
Definition:
melfa_hardware_interface.h:67
ros::Time
MelfaHW::diagnose
void diagnose(diagnostic_updater::DiagnosticStatusWrapper &stat)
Definition:
melfa_hardware_interface.cpp:229
MelfaHW::counter_
int counter_
Definition:
melfa_hardware_interface.h:55
MelfaHW::time_old_
ros::Time time_old_
Definition:
melfa_hardware_interface.h:47
MelfaHW::eff
double eff[JOINT_NUM]
Definition:
melfa_hardware_interface.h:72
MelfaHW::addr_
struct sockaddr_in addr_
Definition:
melfa_hardware_interface.h:51
MelfaHW::read
void read(void)
Definition:
melfa_hardware_interface.cpp:156
diagnostic_updater.h
robot_hw.h
joint_state_interface.h
MelfaHW::use_joint7_
bool use_joint7_
Definition:
melfa_hardware_interface.h:58
MelfaHW::time_now_
ros::Time time_now_
Definition:
melfa_hardware_interface.h:46
strdef.h
MelfaHW::socket_
int socket_
Definition:
melfa_hardware_interface.h:50
MelfaHW::joint7_is_linear_
bool joint7_is_linear_
Definition:
melfa_hardware_interface.h:62
MelfaHW::use_joint8_
bool use_joint8_
Definition:
melfa_hardware_interface.h:60
ros.h
MelfaHW::MelfaHW
MelfaHW(double period)
Definition:
melfa_hardware_interface.cpp:17
MelfaHW::recv_buff_
MXTCMD recv_buff_
Definition:
melfa_hardware_interface.h:54
joint_command_interface.h
ros::Duration
MelfaHW::joint8_is_linear_
bool joint8_is_linear_
Definition:
melfa_hardware_interface.h:64
MelfaHW::update
void update(void)
MelfaHW::write
void write(void)
Definition:
melfa_hardware_interface.cpp:106
hardware_interface::RobotHW
MelfaHW::write_first
void write_first(void)
Definition:
melfa_hardware_interface.cpp:84
JOINT_NUM
#define JOINT_NUM
Definition:
melfa_hardware_interface.h:27
MelfaHW::getPeriod
ros::Duration getPeriod()
Definition:
melfa_hardware_interface.h:40
hardware_interface::PositionJointInterface
MelfaHW::period_
double period_
Definition:
melfa_hardware_interface.h:45
MelfaHW
Definition:
melfa_hardware_interface.h:30
diagnostic_updater::DiagnosticStatusWrapper
MelfaHW::robot_ip_
std::string robot_ip_
Definition:
melfa_hardware_interface.h:49
MelfaHW::joint_state_interface
hardware_interface::JointStateInterface joint_state_interface
Definition:
melfa_hardware_interface.h:66
melfa_driver
Author(s): Ryosuke Tajima
autogenerated on Mon Jun 10 2019 14:04:51