Exemple #1
0
    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()
    elif (dev_name == "aoi_gazebo"):
        protocol = xprotocols.ibuki_gazebo()
        robot = Aoi()
    elif (dev_name == "ibuki"):
        protocol = xprotocols.ibuki()
    elif (dev_name == "commu_with_mobility"):
        protocol = xprotocols.commu_with_mobility()
    else:
Exemple #2
0
        instance.payload = msg.payload
"socket initialization"
"a subscriber to receive and send"
"get ip, port"
if __name__ == "__main__":
    
    motorsock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    nh = rospy.init_node('ibuki_actuators_'+dev_name, anonymous = True)
    param_config = utils.read_yaml('xilva_core', 'ibuki')
    
    _IP = param_config['IP']
    _PORT = param_config['PORT']            
    rate = rospy.Rate(_RATE)
    
    mbed_joint = Joint()   
    logtext = logs.Roslog("ibuki_actuator")
    sub = rospy.Subscriber('/ibuki/encoded_commands', EvansString, callback, mbed_joint)

    while not rospy.is_shutdown():
        if (mbed_joint.payload != ''):
            break
        rospy.sleep(0.5)
        rospy.loginfo("Waiting commands...")
    
    while not rospy.is_shutdown():
        
        embed_msg = mbed_joint.payload
        try:
            motorsock.sendto(embed_msg, (_IP[dev_name], _PORT[dev_name]))
        except socket.error as error:
            if error.errno == errno.ENETUNREACH:
Exemple #3
0
#!/usr/bin/env python
# -*- 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))
Exemple #4
0
            "blend tree to merge normal payloads"
            Evans_payload = self.merge()
            "interrupt mechanism: if interrupt is triggered:"

            "make message"
            utils.make_message(self._pub_msg, 'mixer', 1, 1, Evans_payload)
            self.pub_p.publish(self._pub_msg)
            loop_rate.sleep()


if __name__ == "__main__":

    nh = rospy.init_node("XBus")
    param_config = utils.read_yaml('xilva_core', 'config')
    "start xilva roslog"
    logtext = logs.Roslog("XBus")
    if (param_config == 0):
        rospy.logfatal(logtext.report_log(10))

    "Load Static Variables."
    dev_name = param_config['ref_robot']
    "dofs: the dofs can be more than 50, but not less than 50"
    _DRIVEUNITS = param_config['dofs']
    _RATE = param_config['rate']
    _TRATE = param_config['broadcast']

    "Set ROS parameters."
    rospy.set_param(
        dev_name, {
            'joint_mask_h': param_config['joint_mask_h'],
            'joint_mask_l': param_config['joint_mask_l'],