Main Page
Namespaces
Classes
Files
File List
scripts
master_joint_state.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
# coding: utf-8
3
4
import
rospy
5
from
sensor_msgs.msg
import
JointState
6
from
futaba_serial_servo
import
RS30X
7
8
class
Master
:
9
def
__init__
(self):
10
self.
rs
= RS30X.RS304MD()
11
self.
pub
= rospy.Publisher(
"master_joint_state"
, JointState, queue_size=10)
12
for
i
in
range(1,6):
13
self.rs.setTorque(i,
False
)
14
rospy.sleep(0.01)
15
print
"init done"
16
17
18
def
run
(self):
19
while
not
rospy.is_shutdown():
20
js = JointState()
21
js.name=[
"joint{}"
.format(i)
for
i
in
range(1,6)]
22
js.position = [max(-150,min(150,self.rs.readAngle(i)))
for
i
in
range(1,6)]
23
self.pub.publish(js)
24
rospy.sleep(0.01)
25
26
if
__name__ ==
"__main__"
:
27
rospy.init_node(
"master_joint_state"
)
28
master =
Master
()
29
master.run()
master_joint_state.Master.pub
pub
Definition:
master_joint_state.py:11
master_joint_state.Master.__init__
def __init__(self)
Definition:
master_joint_state.py:9
master_joint_state.Master.run
def run(self)
Definition:
master_joint_state.py:18
master_joint_state.Master.rs
rs
Definition:
master_joint_state.py:10
master_joint_state.Master
Definition:
master_joint_state.py:8
raspigibbon_master_slave
Author(s): Daisuke Sato
, Shota Hirama
autogenerated on Mon Jun 10 2019 14:25:22