generate.py
Go to the documentation of this file.
00001 #! /usr/bin/env python
00002 # -*- coding: utf-8 -*-
00003 #     _____
00004 #    /  _  \
00005 #   / _/ \  \
00006 #  / / \_/   \
00007 # /  \_/  _   \  ___  _    ___   ___   ____   ____   ___   _____  _   _
00008 # \  / \_/ \  / /  _\| |  | __| / _ \ | ┌┐ \ | ┌┐ \ / _ \ |_   _|| | | |
00009 #  \ \_/ \_/ /  | |  | |  | └─┐| |_| || └┘ / | └┘_/| |_| |  | |  | └─┘ |
00010 #   \  \_/  /   | |_ | |_ | ┌─┘|  _  || |\ \ | |   |  _  |  | |  | ┌─┐ |
00011 #    \_____/    \___/|___||___||_| |_||_| \_\|_|   |_| |_|  |_|  |_| |_|
00012 #            ROBOTICS™
00013 #
00014 #
00015 #  Copyright © 2012 Clearpath Robotics, Inc. 
00016 #  All Rights Reserved
00017 #  
00018 # Redistribution and use in source and binary forms, with or without
00019 # modification, are permitted provided that the following conditions are met:
00020 #     * Redistributions of source code must retain the above copyright
00021 #       notice, this list of conditions and the following disclaimer.
00022 #     * Redistributions in binary form must reproduce the above copyright
00023 #       notice, this list of conditions and the following disclaimer in the
00024 #       documentation and/or other materials provided with the distribution.
00025 #     * Neither the name of Clearpath Robotics, Inc. nor the
00026 #       names of its contributors may be used to endorse or promote products
00027 #       derived from this software without specific prior written permission.
00028 # 
00029 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00030 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00031 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00032 # DISCLAIMED. IN NO EVENT SHALL CLEARPATH ROBOTICS, INC. BE LIABLE FOR ANY
00033 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00034 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00035 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00036 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00037 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00038 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00039 #
00040 # Please send comments, questions, or patches to skynet@clearpathrobotics.com
00041 #
00042 
00043 import roslib; roslib.load_manifest('applanix_generated_msgs')
00044 from roslib.packages import get_pkg_dir
00045 from mapping import groups, msgs
00046 from os import path
00047 from sys import stdout
00048 
00049 pkg_dir = get_pkg_dir('applanix_generated_msgs')
00050 output = []
00051 
00052 all_msgs_filename = path.join(pkg_dir, "msg", "AllMsgs.msg")
00053 with open(all_msgs_filename, "w") as all_msgs_f:
00054   all_msgs_f.write("time last_changed\n")
00055   all_msgs_f.write("time last_sent\n")
00056   for msg_num in msgs.keys():
00057     msg_tuple = msgs[msg_num]
00058     if msg_tuple:
00059       name, msg_cls = msg_tuple
00060       if msg_cls.in_all_msgs: 
00061         all_msgs_f.write("applanix_msgs/%s %s\n" % (msg_cls.__name__, name))
00062 
00063       if name != "ack":
00064         msg_srv_filename = path.join(pkg_dir, "srv", "%s.srv" % msg_cls.__name__)
00065         output.append("%s.srv" % msg_cls.__name__)
00066         with open(msg_srv_filename, "w") as msg_srv_f:
00067           msg_srv_f.write("applanix_msgs/%s request\n" % msg_cls.__name__)
00068           msg_srv_f.write("---\n")
00069           msg_srv_f.write("applanix_msgs/Ack ack")
00070 
00071 stdout.write(";".join(output))


applanix_generated_msgs
Author(s): Mike Purvis
autogenerated on Thu Jan 2 2014 11:05:11