Revision c7b564bb
Added node for testing motors
testing/motors_test/CMakeLists.txt | ||
---|---|---|
1 |
cmake_minimum_required(VERSION 2.4.6) |
|
2 |
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) |
|
3 |
|
|
4 |
# Set the build type. Options are: |
|
5 |
# Coverage : w/ debug symbols, w/o optimization, w/ code-coverage |
|
6 |
# Debug : w/ debug symbols, w/o optimization |
|
7 |
# Release : w/o debug symbols, w/ optimization |
|
8 |
# RelWithDebInfo : w/ debug symbols, w/ optimization |
|
9 |
# MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries |
|
10 |
#set(ROS_BUILD_TYPE RelWithDebInfo) |
|
11 |
|
|
12 |
rosbuild_init() |
|
13 |
|
|
14 |
#set the default path for built executables to the "bin" directory |
|
15 |
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) |
|
16 |
#set the default path for built libraries to the "lib" directory |
|
17 |
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) |
|
18 |
|
|
19 |
#uncomment if you have defined messages |
|
20 |
#rosbuild_genmsg() |
|
21 |
#uncomment if you have defined services |
|
22 |
#rosbuild_gensrv() |
|
23 |
|
|
24 |
#common commands for building c++ executables and libraries |
|
25 |
#rosbuild_add_library(${PROJECT_NAME} src/example.cpp) |
|
26 |
#target_link_libraries(${PROJECT_NAME} another_library) |
|
27 |
#rosbuild_add_boost_directories() |
|
28 |
#rosbuild_link_boost(${PROJECT_NAME} thread) |
|
29 |
#rosbuild_add_executable(example examples/example.cpp) |
|
30 |
#target_link_libraries(example ${PROJECT_NAME}) |
testing/motors_test/Makefile | ||
---|---|---|
1 |
include $(shell rospack find mk)/cmake.mk |
testing/motors_test/mainpage.dox | ||
---|---|---|
1 |
/** |
|
2 |
\mainpage |
|
3 |
\htmlinclude manifest.html |
|
4 |
|
|
5 |
\b motors_test |
|
6 |
|
|
7 |
<!-- |
|
8 |
Provide an overview of your package. |
|
9 |
--> |
|
10 |
|
|
11 |
--> |
|
12 |
|
|
13 |
|
|
14 |
*/ |
testing/motors_test/manifest.xml | ||
---|---|---|
1 |
<package> |
|
2 |
<description brief="motors_test"> |
|
3 |
|
|
4 |
motors_test |
|
5 |
|
|
6 |
</description> |
|
7 |
<author>Thomas Mullins</author> |
|
8 |
<license>BSD</license> |
|
9 |
<review status="unreviewed" notes=""/> |
|
10 |
<url>http://ros.org/wiki/motors_test</url> |
|
11 |
<depend package="rospy"/> |
|
12 |
<depend package="motors"/> |
|
13 |
|
|
14 |
</package> |
|
15 |
|
|
16 |
|
testing/motors_test/motors_test.py | ||
---|---|---|
1 |
#!/usr/bin/python |
|
2 |
|
|
3 |
import roslib; roslib.load_manifest('motors_test') |
|
4 |
import rospy |
|
5 |
from motors.msg import set_motors |
|
6 |
|
|
7 |
if __name__ == '__main__': |
|
8 |
rospy.init_node('motors_test') |
|
9 |
|
|
10 |
pub = rospy.Publisher('/set_motors', set_motors) |
|
11 |
msg = set_motors(fl_set=True, fl_speed=0) |
|
12 |
fl_ds = 5 |
|
13 |
|
|
14 |
while not rospy.is_shutdown(): |
|
15 |
|
|
16 |
msg.fl_speed += fl_ds |
|
17 |
|
|
18 |
if msg.fl_speed >= 100: |
|
19 |
fl_ds = -5 |
|
20 |
msg.fl_speed = 100 |
|
21 |
elif msg.fl_speed <= -100: |
|
22 |
fl_ds = 5 |
|
23 |
msg.fl_speed = -100 |
|
24 |
|
|
25 |
pub.publish(msg) |
|
26 |
|
|
27 |
rospy.sleep(0.05) |
Also available in: Unified diff