Exemple #1
0
 def setXYValues(self,newX,newY):
     vel = CMDVel()
     myW=-newX*(self.sensors.motors.getMaxW())*2
     myV=-newY*(self.sensors.motors.getMaxV())
     vel.vx = myV
     vel.az = myW
     self.sensors.motors.sendVelocities(vel)
Exemple #2
0
 def setXYValues(self,newX,newY):
     vel = CMDVel()
     myW=-newX*(self.motors.getMaxW())*2
     myV=-newY*(self.motors.getMaxV())
     vel.vx = myV
     vel.az = myW
     self.motors.sendVelocities(vel)
Exemple #3
0
 def setXYValues(self, newX, newY):
     self.XValue.setText(str(newX))
     self.YValue.setText(str(newY))
     if (self.motors):
         vel = CMDVel()
         myW=-newX*self.motors.getMaxW()
         myV=-newY*self.motors.getMaxV()
         vel.vx = myV
         vel.az = myW
         self.motors.sendVelocities(vel)
Exemple #4
0
 def setXYValues(self, newX, newY):
     self.XValue.setText(str(newX))
     self.YValue.setText(str(newY))
     if (self.motors):
         vel = CMDVel()
         myW = -newX * self.motors.getMaxW()
         myV = -newY * self.motors.getMaxV()
         vel.vx = myV
         vel.az = myW
         self.motors.sendVelocities(vel)
    def __init__(self, topic, jdrc):
        '''
        PublisherCMDVel Constructor.

        @param topic: ROS topic to publish
        @param jdrc: jderobot Communicator
        
        @type topic: String
        @type jdrc: jderobot Communicator

        '''
        rospy.init_node("ss")
        self.topic = topic
        self.jdrc = jdrc
        self.vel = CMDVel()
        self.pub = self.pub = rospy.Publisher(topic,
                                              TwistStamped,
                                              queue_size=1)
        self.lock = threading.Lock()

        self.kill_event = threading.Event()
        self.thread = ThreadPublisher(self, self.kill_event)

        self.thread.daemon = True
        self.start()
    def __init__(self, jdrc):
        """
        Init method.

        @param jdrc:
        """

        # variables

        self.__vel = CMDVel()

        # get clients
        self.__motors_client = jdrc.getMotorsClient("robot.Motors")
        self.__laser_client = jdrc.getLaserClient("robot.Laser")
Exemple #7
0
    def __init__(self, ic, node):
        """
        Init method.

        @param ic: 
        @param node: 
        """

        # variables
        self.__vel = CMDVel()

        # get clients
        self.__motors_client = comm.getMotorsClient(ic, "robot.Motors", node)
        self.__laser_client = comm.getLaserClient(ic, "robot.Laser", node)
Exemple #8
0
    def __init__(self, cfg):
        """
        Init method.

        @param cfg:
        """
        jdrc = comm.init(cfg, 'robot')

        # variables

        self.__vel = CMDVel()

        # get clients
        self.__pose3d_client = jdrc.getPose3dClient("robot.Pose3D")
        self.__motors_client = jdrc.getMotorsClient("robot.Motors")
        self.__laser_client = jdrc.getLaserClient("robot.Laser")
Exemple #9
0
    def __init__(self, cfg):
        """
        Init method.

        @param cfg:
        """

        # ymlNode = cfg.getProperty("robot") # return dict with properties from yml
        # get node
        self.__node = rospy.init_node("robot", anonymous=True)

        # get clients
        prefix = "robot.Pose3D"
        print("Receiving " + prefix + " from ROS messages")
        topic = cfg.getProperty(prefix + ".Topic")
        self.__pose3d_client = ListenerPose3d(topic)

        prefix = "robot.Motors"
        print("Publishing " + prefix + " with ROS messages")
        topic = cfg.getProperty(prefix + ".Topic")
        maxW = cfg.getPropertyWithDefault(prefix + ".maxW", 0.5)
        if not maxW:
            maxW = 0.5
            print(prefix + ".maxW not provided, the default value is used: " +
                  repr(maxW))

        maxV = cfg.getPropertyWithDefault(prefix + ".maxV", 5)
        if not maxV:
            maxV = 5
            print(prefix + ".maxV not provided, the default value is used: " +
                  repr(maxV))

        self.__motors_client = PublisherMotors(topic, maxV, maxW)

        prefix = "robot.Laser"
        print("Receiving " + prefix + " from ROS messages")
        topic = cfg.getProperty(prefix + ".Topic")
        self.__laser_client = ListenerLaser(topic)

        # variables

        self.__vel = CMDVel()
Exemple #10
0
    def __init__(self, jdrc, prefix):
        self.lock = threading.Lock()
        ic = jdrc.getIc()

        self.vel = CMDVel()

        try:
            proxyStr = jdrc.getConfig().getProperty(prefix + ".Proxy")
            base = ic.stringToProxy(proxyStr)
            self.proxy = jderobot.CMDVelPrx.checkedCast(base)

            if not self.proxy:
                print('Interface ' + prefix + ' not configured')

        except Ice.ConnectionRefusedException:
            print(prefix + ': connection refused')

        except:
            traceback.print_exc()
            exit(-1)
Exemple #11
0
    def __init__(self, topic, maxV, maxW):
        '''
        ListenerMotors Constructor.

        @param topic: ROS topic to publish
        
        @type topic: String

        '''
        self.maxW = maxW
        self.maxV = maxV

        self.topic = topic
        self.data = CMDVel()
        self.pub = self.pub = rospy.Publisher(self.topic, Twist, queue_size=1)
        self.lock = threading.Lock()

        self.kill_event = threading.Event()
        self.thread = ThreadPublisher(self, self.kill_event)

        self.thread.daemon = True
        self.start()
    def __init__(self, topic, jdrc):
        '''
        PublisherCMDVel Constructor.

        @param topic: ROS topic to publish
        @param jdrc: jderobot Communicator
        
        @type topic: String
        @type jdrc: jderobot Communicator

        '''
        self.node = rclpy.create_node("CmdVel_pub")
        self.topic = topic
        self.jdrc = jdrc
        self.vel = CMDVel()
        self.pub = self.pub = self.node.create_publisher(
            TwistStamped, topic, 1)
        self.lock = threading.Lock()

        self.kill_event = threading.Event()
        self.thread = ThreadPublisher(self, self.kill_event)

        self.thread.daemon = True
        self.start()
Exemple #13
0
#!/usr/bin/env python3
import config
import comm
import sys
import time
import signal

from jderobotTypes import CMDVel




if __name__ == '__main__':

    cfg = config.load(sys.argv[1])
    jdrc= comm.init(cfg, "Test")

    vel = CMDVel()
    vel.vx = 1
    vel.az = 0.1

    client = jdrc.getMotorsClient("Test.Motors")
    for i in range (10):
        client.sendVelocities(vel)
        time.sleep(1)

    jdrc.destroy()
Exemple #14
0
#!/usr/bin/env python3
import easyiceconfig as EasyIce
import jderobotComm as comm
import sys
import time
import signal

from jderobotTypes import CMDVel




if __name__ == '__main__':

    ic = EasyIce.initialize(sys.argv)
    ic, node = comm.init(ic)

    vel = CMDVel()
    vel.vx = 1
    vel.az = 0.1

    client = comm.getMotorsClient(ic, "kobukiViewer.Motors")
    #client2 = comm.getLaserClient(ic, "kobukiViewer.Laser")
    for i in range (10):
        client.sendVelocities(vel)
        time.sleep(1)

    comm.destroy(ic, node)