Commit 6f46410a authored by Tommy Olofsson's avatar Tommy Olofsson
Browse files

Some mock-up with the wanted types.

parents
*~
Makefile
build/
msg_gen/
src/ros_extctrl
cmake_minimum_required(VERSION 2.4.6)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
# Set the build type. Options are:
# Coverage : w/ debug symbols, w/o optimization, w/ code-coverage
# Debug : w/ debug symbols, w/o optimization
# Release : w/o debug symbols, w/ optimization
# RelWithDebInfo : w/ debug symbols, w/ optimization
# MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)
rosbuild_init()
#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
#uncomment if you have defined messages
rosbuild_genmsg()
#uncomment if you have defined services
#rosbuild_gensrv()
#common commands for building c++ executables and libraries
#rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
#target_link_libraries(${PROJECT_NAME} another_library)
#rosbuild_add_boost_directories()
#rosbuild_link_boost(${PROJECT_NAME} thread)
#rosbuild_add_executable(example examples/example.cpp)
#target_link_libraries(example ${PROJECT_NAME})
<bridge name="extctrl_bridge" port="7357">
<!-- TODO: What controller do we have time to integrate with? -->
<!-- We will probably add a custom conversion here... -->
<topics_in>
<topic name="/extctrl_status" />
</topics_in>
<topics_out>
<topic name="/extctrl_cmd" />
</topics_out>
</bridge>
/**
\mainpage
\htmlinclude manifest.html
\b ros_extctrl
<!--
Provide an overview of your package.
-->
-->
*/
<package>
<description brief="ros_extctrl">
ros_extctrl contains the message types for interacting with the
upcoming controller for Automatica. Contains only the interface
mentioned in the email thread 20140505.
</description>
<author>Tommy</author>
<license>BSD</license>
<review status="unreviewed" notes=""/>
<url>http://ros.org/wiki/ros_extctrl</url>
<depend package="geometry_msgs" />
</package>
uint32 aua_id # Controller ID (0 to deactivate)
geometry_msgs/PoseStamped pose
#!/usr/bin/env python
# The bridge generator cannot make an external service look lika a
# ROS service, only the opposite. That would seem a better fit here
# though...
import roslib; roslib.load_manifest('ros_extctrl')
import rospy
from ros_extctrl.msg import ExtCtrlCmd, ExtCtrlStatus
def handle_extctrl_status(data):
print("Controller responded with %d" % data.status)
def interact(pub):
while not rospy.is_shutdown():
line = ''
try:
line = raw_input("Choose a controller to activate:")
except EOFError:
print('\nBye')
break
ctrl = 0
try:
ctrl = int(line)
except ValueError:
print("%s is not a number" % line)
continue
msg = ExtCtrlCmd()
msg.aua_id = ctrl
msg.pose.pose.position.x = 0.0
msg.pose.pose.position.y = 0.0
msg.pose.pose.position.z = 0.0
msg.pose.pose.orientation.x = 0.0
msg.pose.pose.orientation.y = 0.0
msg.pose.pose.orientation.z = 0.0
msg.pose.pose.orientation.w = 0.0
pub.publish(msg)
if __name__ == '__main__':
rospy.init_node('extctrl_example')
pub = rospy.Publisher('extctrl_cmd', ExtCtrlCmd)
sub = rospy.Subscriber('extctrl_status', ExtCtrlStatus,
handle_extctrl_status)
interact(pub)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment