100k_1m_connection.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 import roslib
00003 roslib.load_manifest('mini_maxwell')
00004 import rospy
00005 import sys
00006 import random
00007 import os
00008 
00009 import rospkg
00010 rospack = rospkg.RosPack()
00011 sys.path.append(rospack.get_path('mini_maxwell') + "/scripts")
00012 
00013 from mm2client import *
00014 from ros_client import MMClient
00015 from dynamic_reconfigure.server import Server as DynamicReconfigureServer
00016 from mini_maxwell.cfg import RosClientConfig as ConfigType
00017 
00018 class MMSwitchingConnection(MMClient):
00019     def __init__(self):
00020         self.use_A = True
00021 
00022         self.rate_limit_A = 1000 * 1000 #1Mbps
00023         self.rate_limit_B = 100  * 1000 #100kbps
00024         self.round_trip_A = 0
00025         self.round_trip_B = 0
00026 
00027         rospy.set_param('~rate_limit', self.rate_limit_A)
00028         rospy.set_param('~round_trip', self.round_trip_A)
00029 
00030         rospy.Timer(rospy.Duration(10), self.changeConnection)
00031 
00032         MMClient.__init__(self)
00033 
00034     def changeConnection(self, event):
00035         self.use_A = not self.use_A
00036         if self.use_A:
00037             self.rate_limit = self.rate_limit_A
00038             self.round_trip = self.round_trip_A
00039         else:
00040             self.rate_limit = self.rate_limit_B
00041             self.round_trip = self.round_trip_B
00042         self.updateMM()
00043 
00044 
00045 if __name__ == '__main__':
00046     rospy.init_node('mini_maxwell_switching_connection')
00047 
00048     try:
00049         mmc = MMSwitchingConnection()
00050     except rospy.ROSInterruptException: pass


mini_maxwell
Author(s): Yusuke Furuta
autogenerated on Wed Jul 10 2019 03:24:08