5 from drc_task_common.srv
import StringRequest, StringRequestResponse
8 imp.find_module(
"std_msgs")
10 import roslib; roslib.load_manifest(
'jsk_teleop_joy')
13 from std_msgs.msg
import String, Float64, Bool, Float32
14 from std_srvs.srv
import Empty, EmptyResponse
15 from geometry_msgs.msg
import PoseStamped
16 import xml.etree.ElementTree
as ET
17 import os, sys, time, numpy
21 JSKJoyPlugin.__init__(self, name, args)
23 "handle":
HandleCommandState(
"handle", Float64, Float32,
"drive/controller/goal_handle_angle"),
31 print(
"Joystick initialization is finished", file=sys.stderr)
36 def joyCB(self, status, history):
37 latest = history.latest()
38 handle_resolution = 0.025
39 neck_y_resolution = 0.1
40 neck_y_angle_max = 35.0
41 neck_y_angle_min = -35.0
42 neck_p_resolution = 0.1
43 neck_p_angle_max = 35.0
44 neck_p_angle_min = -35.0
45 max_accel_resolution = 0.05
46 max_brake_resolution = 1.0
52 if status.left_analog_x:
65 if status.right_analog_y:
66 self.
command_states[
"accel"].command = max(status.right_analog_y, 0.0)
67 if status.right_analog_y < -0.5:
75 for command
in self.command_states.values():
76 command.publishCommand()
79 next_value = current_value + resolution
80 if next_value > max_value:
81 next_value = max_value
82 elif next_value < min_value:
83 next_value = min_value
87 for command
in self.command_states.values():
91 print(
"Sync " + key, file=sys.stderr)
95 for key
in self.command_states.keys():
100 print(
"set execute_flag as " + str(self.
execute_flag), file=sys.stderr)
103 print(
"initialize vehicle joy", file=sys.stderr)
105 return EmptyResponse()
108 key = req.data.lower()
117 print(
"Invalid key", file=sys.stderr)
118 return StringRequestResponse()
121 def __init__(self, command_name, pub_type, sub_type, robot_topic):
144 print(
"Sync with " + self.
robot_topic, file=sys.stderr)
147 except rospy.ROSException
as e:
148 print(
"Cannot subscribe " + self.
robot_topic, file=sys.stderr)
151 self.publisher.publish(pub_msg)
def joyCB(self, status, history)
def commandJointAngle(self, current_value, resolution, max_value, min_value)
def __init__(self, command_name, pub_type, sub_type, robot_topic)
def initializeServiceCallback(self, req)
def synchronize(self, timeout=1.0)
def initializeAllCommand(self)
def synchronizeCommand(self, key)
def __init__(self, name, args)
def synchronizeAllCommand(self)
def executeFlagCallback(self, msg)
def synchronizeServiceCallback(self, req)