test.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 # MIT License
00004 #
00005 # Copyright (c) <2015> <Ikergune, Etxetar>
00006 #
00007 # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
00008 # (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
00009 # publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
00010 # subject to the following conditions:
00011 #
00012 # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
00013 #
00014 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00015 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
00016 # FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
00017 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00018 
00019 import rospy
00020 import time
00021 
00022 from include.constants import *
00023 from include.pubsub.pubSubFactory import PublisherFactory
00024 
00025 from include.ros.rosutils import *
00026 
00027 from std_msgs.msg import String
00028 
00029 # Main function.
00030 if __name__ == '__main__':
00031     # Initialize the node and name it.
00032     rospy.init_node('firos_testing')
00033 
00034     print "\nStarting Firos Testing..."
00035     print "---------------------------------\n"
00036 
00037     initial = False
00038     wait = True
00039 
00040     if initial:
00041         initial_pos = "robot1"
00042         ending_pos = "robot2"
00043     else:
00044         initial_pos = "robot2"
00045         ending_pos = "robot1"
00046 
00047 
00048     CloudPublisher = PublisherFactory.create()
00049     # CloudPublisher.publish("talker2", DEFAULT_CONTEXT_TYPE, [{"name": "move", "type": "NotYet", "value": {"x_pose": time.time(), "y_pose": 56, "z_pose": 32}}])
00050     # CloudPublisher.publish("talker2", DEFAULT_CONTEXT_TYPE, [{"name": "talk", "type": "NotYet", "value": "Hola mundo!!!" + str(time.time())}])
00051 
00052     # print CloudPublisher.createContent("cmd_vel", "NotYet", {"linear": {"x": 5.5, "y": 0.0, "z": 0.0},"angular": {"x": 0.0, "y": 0.0, "z": 0.0}})
00053     # CloudPublisher.publish("robot2", DEFAULT_CONTEXT_TYPE, [CloudPublisher.createContent("cmd_vel_mux/input/teleop", "NotYet", {"linear": {"x": -0.5, "y": 0.0, "z": 0.0},"angular": {"x": 0.0, "y": 0.0, "z": 0.0}})])
00054     CloudPublisher.publish("turtle1", DEFAULT_CONTEXT_TYPE, [CloudPublisher.createContent("cmd_vel", "NotYet", {"linear": {"x": -1.5, "y": 0.0, "z": 0.0},"angular": {"x": 0.0, "y": 0.0, "z": 0.0}})])
00055     # text = String()
00056     # text.data = "Hello topic"
00057     # CloudPublisher.publish("myrobot", DEFAULT_CONTEXT_TYPE, [CloudPublisher.createContent("topic", "NotYet", ros2Obj(text))])
00058 
00059 
00060     # CloudPublisher.publish(initial_pos, DEFAULT_CONTEXT_TYPE, [CloudPublisher.createContent("move_base_simple/goal", "NotYet", {
00061     #     "header": {
00062     #         "seq": 0,
00063     #         "stamp": "now",
00064     #         "frame_id": "map"
00065     #     },
00066     #     "pose": {
00067     #         "position": {
00068     #             "x": 0.8,
00069     #             "y": 0.8,
00070     #             "z": 0.0
00071     #         },
00072     #         "orientation": {
00073     #             "w": 1.0
00074     #         }
00075     #     }
00076     # })])
00077 
00078     # if wait:
00079     #     time.sleep(1.5)
00080 
00081     # CloudPublisher.publish(ending_pos, DEFAULT_CONTEXT_TYPE, [CloudPublisher.createContent("move_base_simple/goal", "NotYet", {
00082     #     "header": {
00083     #         "seq": 0,
00084     #         "stamp": "now",
00085     #         "frame_id": "map"
00086     #     },
00087     #     "pose": {
00088     #         "position": {
00089     #             "x": -2.5,
00090     #             "y": -0.8,
00091     #             "z": 0.0
00092     #         },
00093     #         "orientation": {
00094     #             "w": 1.0
00095     #         }
00096     #     }
00097     # })])
00098 
00099     # if wait:
00100     #     time.sleep(1)
00101 
00102 


firos
Author(s): IƱigo Gonzalez, igonzalez@ikergune.com
autogenerated on Thu Jun 6 2019 17:51:04