-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'atp-smart-servo-ros1-578' of https://github.com/space-c…
…oncordia-robotics/robotics-prototype into atp-smart-servo-ros1-578
- Loading branch information
Showing
10 changed files
with
207 additions
and
32 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
robot/rospackages/src/mcu_control/config/joy_comms_test_config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
enable_button: 5 | ||
next_layout_button: "BUTTON_OPTION" | ||
previous_layout_button: "BUTTON_SHARE" | ||
controller_type: 1 | ||
#number of commands has to match the number of mappings in controller_mappings and topics in command_topics | ||
stop_commands: | ||
- "motors_stop" | ||
- "motors_estop" | ||
#number of topics has to match the number of mappings in controller_mappings and commands in stop_commands | ||
command_topics: | ||
- /arm_command | ||
- /rover_command | ||
#number of mappings has to match the number of topics in command_topics and commands in stop_commands | ||
controller_mappings: | ||
- - ["TRIGGER_R2","set_motor_speeds %a 0 0 0 0 0",10,250] | ||
- ["TRIGGER_L2","set_motor_speeds -%a 0 0 0 0 0",10,250] | ||
- ["JOY_LEFT_Y","set_motor_speeds 0 %a 0 0 0 0",10,250] | ||
- ["JOY_LEFT_X","set_motor_speeds 0 0 %a 0 0 0",10,250] | ||
- ["JOY_RIGHT_Y","set_motor_speeds 0 0 0 %a 0 0",10,250] | ||
- ["JOY_RIGHT_X","set_motor_speeds 0 0 0 0 %a 0",10,250] | ||
- ["BUTTON_CIRCLE","set_motor_speeds 0 0 0 0 0 250",10,250] | ||
- ["BUTTON_SQUARE","set_motor_speeds 0 0 0 0 0 -250",10,250] | ||
- - ["TRIGGER_L2","move_wheels %a %a %a -%a -%a -%a",10,250] | ||
- ["TRIGGER_R2","move_wheels -%a -%a -%a %a %a %a",10,250] | ||
- ["JOY_RIGHT_X","move_wheels -%a -%a -%a -%a -%a -%a",10,250] | ||
- ["BUTTON_CROSS","blink_toggle 1",10,250] | ||
- ["BUTTON_CIRCLE","blink_toggle 0",10,250] |
18 changes: 18 additions & 0 deletions
18
robot/rospackages/src/mcu_control/launch/camera_streams.launch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<launch> | ||
<node name="video0" pkg="cv_camera" type="cv_camera_node"> | ||
<param name="device_id" value="1" /> | ||
<param name="rate" value="5" /> | ||
</node> | ||
<node name="video1" pkg="cv_camera" type="cv_camera_node"> | ||
<param name="device_id" value="2" /> | ||
<param name="rate" value="5" /> | ||
</node> | ||
<node name="video2" pkg="cv_camera" type="cv_camera_node"> | ||
<param name="device_id" value="3" /> | ||
<param name="rate" value="5" /> | ||
</node> | ||
<node name="video3" pkg="cv_camera" type="cv_camera_node"> | ||
<param name="device_id" value="4" /> | ||
<param name="rate" value="5" /> | ||
</node> | ||
</launch> |
13 changes: 13 additions & 0 deletions
13
robot/rospackages/src/mcu_control/launch/joy_comms_test.launch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<launch> | ||
|
||
<arg name="joy_dev" default="/dev/input/js0"/> | ||
<arg name="joy_comms_config_file" default="$(find mcu_control)/config/joy_comms_test_config.yaml"/> | ||
|
||
<node name="joy_comms" pkg="mcu_control" type="joy_comms_control_node" output="screen"> | ||
<rosparam command="load" file="$(arg joy_comms_config_file)"/> | ||
</node> | ||
|
||
<node name="joy_test" pkg="mcu_control" type="JoyTestNode.py" output="screen"> | ||
</node> | ||
|
||
</launch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import rospy | ||
from sensor_msgs.msg import Joy | ||
import time | ||
|
||
class PlayStation(Joy): | ||
_button_names = {"BUTTON_CROSS": 0, | ||
"BUTTON_CIRCLE": 1, | ||
"BUTTON_TRIANGLE": 2, | ||
"BUTTON_SQUARE": 3, | ||
"BUTTON_L1": 4, | ||
"BUTTON_R1": 5, | ||
"BUTTON_L2": 6, | ||
"BUTTON_R2": 7, | ||
"BUTTON_SHARE": 8, | ||
"BUTTON_OPTION": 9, | ||
"BUTTON_HOME": 10, | ||
"BUTTON_L3": 11, | ||
"BUTTON_R3": 12} | ||
_axis_names = {"JOY_LEFT_X": 0, | ||
"JOY_LEFT_Y": 1, | ||
"TRIGGER_L2": 2, | ||
"JOY_RIGHT_X": 3, | ||
"JOY_RIGHT_Y": 4, | ||
"TRIGGER_R2": 5, | ||
"DPAD_X": 6, | ||
"DPAD_Y": 7} | ||
|
||
def __init__(self): | ||
Joy.__init__(self) | ||
self.buttons = [0 for x in range(len(PlayStation._button_names))] | ||
self.axes = [0.0 for x in range(len(PlayStation._axis_names))] | ||
|
||
def get_button(self, button_name): | ||
return self.buttons[PlayStation._button_names[button_name]] | ||
|
||
def set_button(self, button_name, value): | ||
self.buttons[PlayStation._button_names[button_name]] = value | ||
|
||
def get_axis(self, axis_name): | ||
return self.axes[PlayStation._axis_names[axis_name]] | ||
|
||
def set_axis(self, axis_name, value): | ||
self.axes[PlayStation._axis_names[axis_name]] = value | ||
|
||
def add_to_axis(self, axis_name, increment): | ||
self.axes[PlayStation._axis_names[axis_name]] += increment | ||
|
||
|
||
|
||
|
||
if __name__ == "__main__": | ||
node_name = 'joy_test_node' | ||
rospy.init_node(node_name, anonymous=False) # only allow one node of this type | ||
|
||
joy_topic = '/joy' | ||
rospy.loginfo('Beginning to publish to "'+joy_topic+'" topic') | ||
joyPub = rospy.Publisher(joy_topic, Joy, queue_size=10) | ||
|
||
j = PlayStation() | ||
j.set_button("BUTTON_R1", 1) # enable | ||
|
||
# ping us into wheel mode | ||
time.sleep(1) | ||
joyPub.publish(j) | ||
j.set_button("BUTTON_SHARE", 1) | ||
joyPub.publish(j) | ||
j.set_button("BUTTON_SHARE", 0) | ||
time.sleep(1) | ||
|
||
rate = rospy.Rate(2) | ||
increment = 0.125 | ||
|
||
# R2 partly pressed to test summation | ||
j.set_axis("TRIGGER_R2", 0.5) | ||
|
||
while not rospy.is_shutdown(): | ||
j.add_to_axis("JOY_RIGHT_X", increment) | ||
|
||
if j.get_axis("JOY_RIGHT_X") >= 1.0 or j.get_axis("JOY_RIGHT_X") <= -1.0: | ||
# stay at max a little while | ||
for i in range(5): | ||
joyPub.publish(j) | ||
time.sleep(0.5) | ||
increment = -increment | ||
|
||
joyPub.publish(j) | ||
|
||
rate.sleep() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters