-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'misc_devel' into route_devel
- Loading branch information
Showing
9 changed files
with
908 additions
and
1 deletion.
There are no files selected for viewing
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
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,82 @@ | ||
#!/usr/bin/env python | ||
|
||
# ----------------------------------------------- # | ||
# Table of index number of /joy.buttons: | ||
# Index Button name on the actual controller | ||
# | ||
# 0 A | ||
# 1 B | ||
# 2 X | ||
# 3 Y | ||
# 4 LB | ||
# 5 RB | ||
# 6 back | ||
# 7 start | ||
# 8 power | ||
# 9 Button stick left | ||
# 10 Button stick right | ||
|
||
# Table of index number of /joy.axes: | ||
# Index Axis name on the actual controller | ||
# | ||
# 0 Moving left joystick left (+) and right (-) changes rotational velocity | ||
# 1 Moving left joystick up (+) and down (-) changes linear velocity | ||
# 2 LT | ||
# 3 Left/Right Axis stick right | ||
# 4 Up/Down Axis stick right | ||
# 5 RT | ||
# 6 cross key left/right | ||
# 7 cross key up/down | ||
# ----------------------------------------------- # | ||
|
||
# import required packages | ||
import rospy | ||
from geometry_msgs.msg import Twist | ||
from sensor_msgs.msg import Joy | ||
|
||
class TeleopControl: | ||
|
||
# Constructor | ||
def __init__(self): | ||
|
||
# Initialize publishers | ||
self.drive_pub = rospy.Publisher('drive_cmd', Twist) | ||
# other publishers will be added when necessary | ||
|
||
# Initialize subscribers | ||
self.joy_sub = rospy.Subscriber("joy", Joy, self.joy_callback) | ||
|
||
|
||
# Callback function for joystick controls | ||
def joy_callback(self, data): | ||
self.set_drive_speed(data) | ||
self.set_digging_mode(data) | ||
|
||
# Sets drive speed based on left joystick input | ||
def set_drive_speed(self, data): | ||
twist = Twist() | ||
twist.linear.x = data.axes[1] | ||
twist.angular.z = data.axes[0] | ||
self.drive_pub.publish(twist) | ||
|
||
# Sets digging mode based on ???? (TBD) | ||
def set_digging_mode(self, data): | ||
pass | ||
|
||
# additional functions TBD | ||
|
||
|
||
if __name__ == '__main__': | ||
|
||
# Initialize as ROS node | ||
rospy.init_node('teleop_control') | ||
|
||
# Create a TeleopControl object | ||
control = TeleopControl() | ||
|
||
# Ready to go | ||
rospy.loginfo("Teleop Control initialized...") | ||
|
||
# Loop continuously | ||
while not rospy.is_shutdown(): | ||
pass |
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,68 @@ | ||
body { | ||
margin: 0px; | ||
} | ||
|
||
table { | ||
border-collapse: collapse; | ||
width: 100%; | ||
} | ||
|
||
td, th { | ||
border: 1px solid #f0f0f0; | ||
text-align: left; | ||
padding: 8px; | ||
font-size: 14px; | ||
} | ||
|
||
td:nth-child(1) { | ||
width: 150px; | ||
} | ||
|
||
tr:nth-child(even) { | ||
background-color: #f0f0f0; | ||
} | ||
|
||
#left_region { | ||
float: left; | ||
width: auto; | ||
max-width: 40%; | ||
margin-right: 30px; | ||
} | ||
|
||
#middle_region { | ||
float: left; | ||
width: 45%; | ||
margin-right: 30px; | ||
} | ||
|
||
#middle_region_left { | ||
float: left; | ||
width: 48%; | ||
margin-right: 4%; | ||
} | ||
|
||
#middle_region_right { | ||
float: left; | ||
width: 48%; | ||
} | ||
|
||
#right_region { | ||
float: left; | ||
width: 15%; | ||
} | ||
|
||
#body_content { | ||
margin-left: auto; | ||
margin-right: auto; | ||
width: 90%; | ||
} | ||
|
||
#header_bar { | ||
background-color: #000000b7; | ||
height: 50px; | ||
margin-bottom: 20px; | ||
} | ||
|
||
#state_image { | ||
max-height: 800px; | ||
} |
Oops, something went wrong.