Skip to content

Commit 3602332

Browse files
authoredJun 4, 2020
Add files via upload
1 parent 9cc974e commit 3602332

12 files changed

+272
-0
lines changed
 

‎CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/opt/ros/kinetic/share/catkin/cmake/toplevel.cmake

‎images/gazebo_world.png

398 KB
Loading

‎images/map_2d_full

10.3 KB
Binary file not shown.

‎images/map_2d_partial

6.58 KB
Binary file not shown.

‎images/map_3d_gazebo_world.png

474 KB
Loading

‎images/map_3d_generation_clouds.png

503 KB
Loading

‎images/rtabmap.yaml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
%YAML:1.0
2+
---
3+
camera_name: rtabmap
4+
image_width: 640
5+
image_height: 480
6+
camera_matrix:
7+
rows: 3
8+
cols: 3
9+
data: [ 5.5438271282264407e+02, 0., 3.2050000000000000e+02,
10+
-3.8806789897585091e+01, 0., 5.5438271282264407e+02,
11+
2.4050000000000000e+02, 0., 0. ]
12+
distortion_coefficients:
13+
rows: 1
14+
cols: 5
15+
data: [ 0., 0., 0., 0., 0. ]
16+
distortion_model: plumb_bob
17+
rectification_matrix:
18+
rows: 3
19+
cols: 3
20+
data: [ 1., 0., 0., 0., 1., 0., 0., 0., 1. ]
21+
projection_matrix:
22+
rows: 3
23+
cols: 4
24+
data: [ 5.5438271282264407e+02, 0., 3.2050000000000000e+02,
25+
-3.8806789897585091e+01, 0., 5.5438271282264407e+02,
26+
2.4050000000000000e+02, 0., 0., 0., 1., 0. ]

‎teleop_twist_keyboard/CHANGELOG.rst

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
0.6.2 (2018-10-21)
2+
------------------
3+
* Replace tabs with spaces, fixes `#15 <https://github.com/ros-teleop/teleop_twist_keyboard/issues/15>`_
4+
* Merge pull request `#13 <https://github.com/ros-teleop/teleop_twist_keyboard/issues/13>`_ from asukiaaa/patch-3
5+
Add rosrun command to specify values
6+
* Add rosrun command to specify values
7+
* Contributors: Asuki Kono, Austin, trainman419
8+
9+
0.6.1 (2018-05-02)
10+
------------------
11+
* Merge pull request `#11 <https://github.com/ros-teleop/teleop_twist_keyboard/issues/11>`_ from MatthijsBurgh/patch-1
12+
Correct exception handling; Python3 print compatible
13+
* import print from future
14+
* Print python3 compatible
15+
* correct Exception handling
16+
* Merge pull request `#7 <https://github.com/ros-teleop/teleop_twist_keyboard/issues/7>`_ from lucasw/speed_params
17+
set linear and turn speed via rosparams
18+
* Using tabs instead of spaces to match rest of file
19+
* set linear and turn speed via rosparams
20+
* Contributors: Austin, Lucas Walter, Matthijs van der Burgh
21+
22+
0.6.0 (2016-03-21)
23+
------------------
24+
* Better instruction formatting
25+
* support holonomic base, send commmand with keyboard down
26+
* Fixing queue_size warning
27+
* Create README.md
28+
* Update the description string in package.xml
29+
* Contributors: Austin, Kei Okada, LiohAu, Mike Purvis, kk6axq, trainman419
30+
31+
0.5.0 (2014-02-11)
32+
------------------
33+
* Initial import from brown_remotelab
34+
* Convert to catkin

‎teleop_twist_keyboard/CMakeLists.txt

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
cmake_minimum_required(VERSION 2.8.3)
2+
project(teleop_twist_keyboard)
3+
4+
find_package(catkin REQUIRED)
5+
6+
catkin_package()
7+
8+
## Mark executable scripts (Python etc.) for installation
9+
## in contrast to setup.py, you can choose the destination
10+
catkin_install_python(PROGRAMS
11+
teleop_twist_keyboard.py
12+
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
13+
)
14+

‎teleop_twist_keyboard/README.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# teleop_twist_keyboard
2+
Generic Keyboard Teleop for ROS
3+
4+
# Launch
5+
Run.
6+
```
7+
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
8+
```
9+
10+
With custom values.
11+
```
12+
rosrun teleop_twist_keyboard teleop_twist_keyboard.py _speed:=0.9 _turn:=0.8
13+
```
14+
15+
Publishing to a different topic (in this case `my_cmd_vel`).
16+
```
17+
rosrun teleop_twist_keyboard teleop_twist_keyboard.py cmd_vel:=my_cmd_vel
18+
```
19+
20+
# Usage
21+
```
22+
Reading from the keyboard and Publishing to Twist!
23+
---------------------------
24+
Moving around:
25+
u i o
26+
j k l
27+
m , .
28+
29+
For Holonomic mode (strafing), hold down the shift key:
30+
---------------------------
31+
U I O
32+
J K L
33+
M < >
34+
35+
t : up (+z)
36+
b : down (-z)
37+
38+
anything else : stop
39+
40+
q/z : increase/decrease max speeds by 10%
41+
w/x : increase/decrease only linear speed by 10%
42+
e/c : increase/decrease only angular speed by 10%
43+
44+
CTRL-C to quit
45+
```
46+

‎teleop_twist_keyboard/package.xml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0"?>
2+
<package>
3+
<name>teleop_twist_keyboard</name>
4+
<version>0.6.2</version>
5+
<description>Generic keyboard teleop for twist robots.</description>
6+
7+
<maintainer email="namniart@gmail.com">Austin Hendrix</maintainer>
8+
9+
<license>BSD</license>
10+
11+
<url type="website">http://wiki.ros.org/teleop_twist_keyboard</url>
12+
13+
<author>Graylin Trevor Jay</author>
14+
15+
<buildtool_depend>catkin</buildtool_depend>
16+
<run_depend>geometry_msgs</run_depend>
17+
<run_depend>rospy</run_depend>
18+
</package>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
#!/usr/bin/env python
2+
3+
from __future__ import print_function
4+
5+
import roslib; roslib.load_manifest('teleop_twist_keyboard')
6+
import rospy
7+
8+
from geometry_msgs.msg import Twist
9+
10+
import sys, select, termios, tty
11+
12+
msg = """
13+
Reading from the keyboard and Publishing to Twist!
14+
---------------------------
15+
Moving around:
16+
u i o
17+
j k l
18+
m , .
19+
20+
For Holonomic mode (strafing), hold down the shift key:
21+
---------------------------
22+
U I O
23+
J K L
24+
M < >
25+
26+
t : up (+z)
27+
b : down (-z)
28+
29+
anything else : stop
30+
31+
q/z : increase/decrease max speeds by 10%
32+
w/x : increase/decrease only linear speed by 10%
33+
e/c : increase/decrease only angular speed by 10%
34+
35+
CTRL-C to quit
36+
"""
37+
38+
moveBindings = {
39+
'i':(1,0,0,0),
40+
'o':(1,0,0,-1),
41+
'j':(0,0,0,1),
42+
'l':(0,0,0,-1),
43+
'u':(1,0,0,1),
44+
',':(-1,0,0,0),
45+
'.':(-1,0,0,1),
46+
'm':(-1,0,0,-1),
47+
'O':(1,-1,0,0),
48+
'I':(1,0,0,0),
49+
'J':(0,1,0,0),
50+
'L':(0,-1,0,0),
51+
'U':(1,1,0,0),
52+
'<':(-1,0,0,0),
53+
'>':(-1,-1,0,0),
54+
'M':(-1,1,0,0),
55+
't':(0,0,1,0),
56+
'b':(0,0,-1,0),
57+
}
58+
59+
speedBindings={
60+
'q':(1.1,1.1),
61+
'z':(.9,.9),
62+
'w':(1.1,1),
63+
'x':(.9,1),
64+
'e':(1,1.1),
65+
'c':(1,.9),
66+
}
67+
68+
def getKey():
69+
tty.setraw(sys.stdin.fileno())
70+
select.select([sys.stdin], [], [], 0)
71+
key = sys.stdin.read(1)
72+
termios.tcsetattr(sys.stdin, termios.TCSADRAIN, settings)
73+
return key
74+
75+
76+
def vels(speed,turn):
77+
return "currently:\tspeed %s\tturn %s " % (speed,turn)
78+
79+
if __name__=="__main__":
80+
settings = termios.tcgetattr(sys.stdin)
81+
82+
pub = rospy.Publisher('cmd_vel', Twist, queue_size = 1)
83+
rospy.init_node('teleop_twist_keyboard')
84+
85+
speed = rospy.get_param("~speed", 0.5)
86+
turn = rospy.get_param("~turn", 1.0)
87+
x = 0
88+
y = 0
89+
z = 0
90+
th = 0
91+
status = 0
92+
93+
try:
94+
print(msg)
95+
print(vels(speed,turn))
96+
while(1):
97+
key = getKey()
98+
if key in moveBindings.keys():
99+
x = moveBindings[key][0]
100+
y = moveBindings[key][1]
101+
z = moveBindings[key][2]
102+
th = moveBindings[key][3]
103+
elif key in speedBindings.keys():
104+
speed = speed * speedBindings[key][0]
105+
turn = turn * speedBindings[key][1]
106+
107+
print(vels(speed,turn))
108+
if (status == 14):
109+
print(msg)
110+
status = (status + 1) % 15
111+
else:
112+
x = 0
113+
y = 0
114+
z = 0
115+
th = 0
116+
if (key == '\x03'):
117+
break
118+
119+
twist = Twist()
120+
twist.linear.x = x*speed; twist.linear.y = y*speed; twist.linear.z = z*speed;
121+
twist.angular.x = 0; twist.angular.y = 0; twist.angular.z = th*turn
122+
pub.publish(twist)
123+
124+
except Exception as e:
125+
print(e)
126+
127+
finally:
128+
twist = Twist()
129+
twist.linear.x = 0; twist.linear.y = 0; twist.linear.z = 0
130+
twist.angular.x = 0; twist.angular.y = 0; twist.angular.z = 0
131+
pub.publish(twist)
132+
133+
termios.tcsetattr(sys.stdin, termios.TCSADRAIN, settings)

0 commit comments

Comments
 (0)
Please sign in to comment.