modbus_client_insight7200.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 ########################################################################### 
00003 # This software is graciously provided by HumaRobotics 
00004 # under the Simplified BSD License on
00005 # github: git@www.humarobotics.com:baxter_tasker
00006 # HumaRobotics is a trademark of Generation Robots.
00007 # www.humarobotics.com 
00008 
00009 # Copyright (c) 2013, Generation Robots.
00010 # All rights reserved.
00011 # www.generationrobots.com
00012 #   
00013 # Redistribution and use in source and binary forms, with or without 
00014 # modification, are permitted provided that the following conditions are met:
00015 # 
00016 # 1. Redistributions of source code must retain the above copyright notice,
00017 #  this list of conditions and the following disclaimer.
00018 # 
00019 # 2. Redistributions in binary form must reproduce the above copyright notice,
00020 #  this list of conditions and the following disclaimer in the documentation 
00021 #  and/or other materials provided with the distribution.
00022 # 
00023 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00024 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
00025 # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
00026 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
00027 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
00028 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
00029 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
00030 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
00031 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
00032 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
00033 # THE POSSIBILITY OF SUCH DAMAGE. 
00034 # 
00035 # The views and conclusions contained in the software and documentation are 
00036 # those of the authors and should not be interpreted as representing official 
00037 # policies, either expressed or implied, of the FreeBSD Project.
00038 
00039 from modbus_cognex_insight.insight_modbus_client import InsightModbusClient 
00040 from std_msgs.msg import Int32MultiArray as HoldingRegister
00041 import rospy
00042 
00043 if __name__=="__main__":
00044     rospy.init_node("modbus_client_insight7200")
00045     rospy.loginfo("""
00046     This file shows the usage of the Modbus Wrapper Client.
00047     To see the read registers of the modbus server use: rostopic echo /modbus_wrapper/input
00048     To see sent something to the modbus use a publisher on the topic /modbus_wrapper/output
00049     This file contains a sample publisher.
00050     """)
00051     host = "192.168.0.110"
00052     
00053     if rospy.has_param("~ip"):
00054         host =  rospy.get_param("~ip")
00055     else:
00056         rospy.loginfo("For not using the default IP %s, add an arg e.g.: '_ip:=\"192.168.0.199\"'",host)
00057     sim=True
00058     if rospy.has_param("~sim"):
00059         sim =  rospy.get_param("~sim")
00060     
00061     
00062     # setup modbus client    
00063     modclient = InsightModbusClient(host,sim)
00064     rospy.loginfo("Setup complete")
00065         
00066     # change the cognex insight job and request the result
00067     for job_id in xrange(1,5): 
00068         rospy.loginfo("Result for job_id %d: %d",job_id,modclient.startVisualInspection(job_id))
00069 
00070     rospy.loginfo("All done.")
00071     rospy.sleep(0.5)
00072     
00073     
00074     
00075    
00076     
00077     


modbus_cognex_insight
Author(s): Sven Bock
autogenerated on Thu Jun 6 2019 17:39:37