Ejemplo n.º 1
0
    def gen_msg(self):
        msg = visiondata()

        for name, piece in self.pieces.items():
            setattr(msg, '{}_x'.format(name), piece.position[0])
            setattr(msg, '{}_y'.format(name), piece.position[1])
            setattr(msg, '{}_w'.format(name), piece.position[2])

        # msg.tm0_x = self.tm0.position[0]
        # msg.tm0_y = self.tm0.position[1]
        # msg.tm0_w = self.tm0.position[2]
        # msg.tm1_x = self.tm1.position[0]
        # msg.tm1_y = self.tm1.position[1]
        # msg.tm1_w = self.tm1.position[2]
        # msg.op0_x = self.op0.position[0]
        # msg.op0_y = self.op0.position[1]
        # msg.op0_w = self.op0.position[2]
        # msg.op1_x = self.op1.position[0]
        # msg.op1_y = self.op1.position[1]
        # msg.op1_w = self.op1.position[2]
        # msg.ball_x = self.ball.position[0]
        # msg.ball_y = self.ball.position[1]

        return msg
    def gen_msg(self):
        msg = visiondata()

        for name, piece in self.pieces.items():
            setattr(msg, "{}_x".format(name), piece.position[0])
            setattr(msg, "{}_y".format(name), piece.position[1])
            setattr(msg, "{}_w".format(name), piece.position[2])

        # msg.tm0_x = self.tm0.position[0]
        # msg.tm0_y = self.tm0.position[1]
        # msg.tm0_w = self.tm0.position[2]
        # msg.tm1_x = self.tm1.position[0]
        # msg.tm1_y = self.tm1.position[1]
        # msg.tm1_w = self.tm1.position[2]
        # msg.op0_x = self.op0.position[0]
        # msg.op0_y = self.op0.position[1]
        # msg.op0_w = self.op0.position[2]
        # msg.op1_x = self.op1.position[0]
        # msg.op1_y = self.op1.position[1]
        # msg.op1_w = self.op1.position[2]
        # msg.ball_x = self.ball.position[0]
        # msg.ball_y = self.ball.position[1]

        return msg
Ejemplo n.º 3
0
#!/usr/bin/env python
# Node where filtering occurs. Recieves data on rostopic inputfilter
# and sends data via output filter topic.
# Author Glade Snyder
import rospy
from std_msgs.msg import String
from robot_soccer.msg import visiondata
import globals
import sample_lpf as lpf
from numpy.matlib import matrix
import copy

filteredData = visiondata()
lastVisionData = visiondata()
newDataFlag = False
gamePieces = lpf.GamePieces()
predictPieces = lpf.GamePieces()


def filter():
    global gamePieces
    global filteredData
    global lastVisionData
    global newDataFlag
    # print lastVisionData
    if newDataFlag:
        gamePieces.update_all(lastVisionData)
        newDataFlag = False
    gamePieces.filter_all()
    predictPieces = copy.copy(gamePieces)
    predictPieces.predict_all()
Ejemplo n.º 4
0
#!/usr/bin/env python
# Node where filtering occurs. Recieves data on rostopic inputfilter
# and sends data via output filter topic.
# Author Glade Snyder
import rospy
from std_msgs.msg import String
from robot_soccer.msg import visiondata
import globals
import sample_lpf as lpf 
from numpy.matlib import matrix
import copy


filteredData = visiondata()
lastVisionData = visiondata()
newDataFlag = False
gamePieces = lpf.GamePieces()
predictPieces = lpf.GamePieces()

def filter():
    global gamePieces
    global filteredData
    global lastVisionData
    global newDataFlag
    # print lastVisionData
    if newDataFlag:
        gamePieces.update_all(lastVisionData)
        newDataFlag = False    
    gamePieces.filter_all()
    predictPieces = copy.copy(gamePieces)
    predictPieces.predict_all()