def __init__(self, _name='ibuki'): print "protocol: using ibuki." self._name = _name self.param_config = utils.read_yaml('xilva_core', self._name) self.directions = np.array(self.get_directions()) self.defaults = np.array(self.get_defaults()) self.maxlimit, self.minlimit = np.array(self.get_limits()) self.mapping = np.array(self.get_mapping()) self.groups = self.get_groups()
def __init__(self): self.param_config = utils.read_yaml('xilva_core', 'ibuki_gazebo') "relationships" self.mapping = self.param_config['mapping'] self.angles = np.array([]) "the selected angles are joints that are used in all fascia system" self.selected_angles = np.array([]) "the line angles are joint angles that are used in a specific line" "<parameters>" self.myu = 0.05 self.pub_msg = Evans() self.sub = rospy.Subscriber('/silva/slave_local/vfp', Evans, self.callback) # self.sub = rospy.Subscriber('/silva/slave_local/vfp', Evans, self.callback) self.pub = rospy.Publisher(topics.slave[2], Evans, queue_size=2)
self._msgid = 1 self._payload = [] def callback(msg, args): instance = args instance._name = msg.name instance._level = msg.level instance._msgid = msg.msgid instance._payload = msg.payload "4. publish the output using the protocol" if __name__ == "__main__": param_config = utils.read_yaml('xilva_core', 'config') _RATE = param_config['rate'] nh = rospy.init_node('X_encoder') rate = rospy.Rate(_RATE) message = Received_msg() "activate logging" logtext = logs.Roslog('X_encoder') "receive the mixer message from the bus" sub = rospy.Subscriber(topics.comm['bus'], Evans, callback, message) "decide the protocol to use" if (dev_name == "ibuki_gazebo"): protocol = xprotocols.ibuki_gazebo() robot = Ibuki()
# -*- coding: utf-8 -*- import rospy from xilva_core.msg import EvansString import socket, errno, sys, os import modules.utils as utils import modules.logging as logs network_flag = 0 if __name__ == "__main__": nh = rospy.init_node('ibuki_netlistener', anonymous = True) logtext = logs.Roslog('ibuki_netlistener') param_config = utils.read_yaml('xilva_core', 'ibuki') _IP = param_config['IP'] _PORT = param_config['PORT'] parts_name = ['neck', 'arml', 'armr', 'handl', 'handr', 'headl', 'headc', 'headr', 'hip', 'wheel'] rate =rospy.Rate(1) while not rospy.is_shutdown(): for dev_name in parts_name: response = os.system("ping -c 1 " +_IP[dev_name]+" -w 1 >/dev/null 2>&1") if response != 0: "interrupt 0 in the future" network_flag = 99 rospy.logwarn('network erros') # rospy.logwarn(logtext(2)) else:
def report_log(self, _code): log_content = utils.read_yaml('xilva_core', 'logtexts')[_code] log_text = "code" + str(_code) + ',' + self._name + ":" + log_content return log_text