ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Probably you have some missing parameters in your launch file while you are running the joy node. Those parameters are introduced under <(!)-- Launch joy node --> comment. What you may fastly do here, just delete the whole node section and try this one instead:
<node pkg="joy" type="joy_node" name="ps3_joy" output="screen" >
<param name="dev" type="string" value="/dev/input/js0" />
<param name="deadzone" value="0.12" />
</node>
<node pkg="diagnostic_aggregator" type="aggregator_node" name="diagnostic_aggregator" >
<!-- Load the file you made above -->
<rosparam command="load" file="$(find ps3joy)/diagnostics.yaml" />
</node>
just be careful that you directed your joystick path in value="/dev/input/js0". - you already mentioned that works, though.
2 | No.2 Revision |
Probably you have some missing parameters in your launch file while you are running the joy node. Those parameters are introduced under <(!)-- Launch joy node --> comment. What you may fastly do here, just delete the whole node section and try this one instead:
<node pkg="joy" type="joy_node" name="ps3_joy" output="screen" >
<param name="dev" type="string" value="/dev/input/js0" />
<param name="deadzone" value="0.12" />
</node>
<node pkg="diagnostic_aggregator" type="aggregator_node" name="diagnostic_aggregator" >
<!-- Load the file you made above -->
<rosparam command="load" file="$(find ps3joy)/diagnostics.yaml" />
</node>
just be careful that you directed your joystick path in value="/dev/input/js0". value="/dev/input/js0"
. - you already mentioned that works, though.
3 | No.3 Revision |
Probably you have some missing parameters in your launch file while you are running the joy node. Those parameters are introduced under <(!)-- Launch joy node --> comment. What you may fastly do here, just delete the whole node section and try this one instead:
<node pkg="joy" type="joy_node" name="ps3_joy" output="screen" >
<param name="dev" type="string" value="/dev/input/js0" />
<param name="deadzone" value="0.12" />
</node>
<node pkg="diagnostic_aggregator" type="aggregator_node" name="diagnostic_aggregator" >
<!-- Load the file you made above -->
<rosparam command="load" file="$(find ps3joy)/diagnostics.yaml" />
</node>
just be careful that you directed your joystick path in value="/dev/input/js0"
. - you already mentioned that works, though.
Edit for the class:
class PS3Status(JoyStatus):
def __init__(self, msg):
JoyStatus.__init__(self)
# creating from sensor_msgs/Joy
if msg.buttons[0] == 1:
self.cross = True
else:
self.cross = False
if msg.buttons[1] == 1:
self.circle = True
else:
self.circle = False
if msg.buttons[2] == 1:
self.triangle = True
else:
self.triangle = False
if msg.buttons[3] == 1:
self.square = True
else:
self.square = False
if msg.buttons[4] == 1:
self.L1 = True
else:
self.L1 = False
if msg.buttons[5] == 1:
self.R1 = True
else:
self.R1 = False
if msg.buttons[6] == 1:
self.L2 = True
else:
self.L2 = False
if msg.buttons[7] == 1:
self.R2 = True
else:
self.R2 = False
if msg.buttons[8] == 1:
self.select = True
else:
self.select = False
if msg.buttons[9] == 1:
self.start = True
else:
self.start = False
if msg.buttons[10] == 1:
self.center = True
else:
self.center = False
self.left_analog_x = msg.axes[0]
self.left_analog_y = msg.axes[1]
self.right_analog_x = msg.axes[3]
self.right_analog_y = msg.axes[4]
self.orig_msg = msg
Also, do not forget to change in the if statement where the module decides which joystick is it:
#elif len(msg.axes) == 20 and len(msg.buttons) == 17: -- this goes
elif len(msg.axes) == 6 and len(msg.buttons) == 17: #and this comes!