Exemple #1
0
    def timer_event(self):
        done = False
        while not done:
            msg = CMessage()
            rcv = self.mod.ReadMessage(msg, 0)
            if rcv == 1:
                msg_type = msg.GetHeader().msg_type

                if msg_type == rc.MT_TASK_STATE_CONFIG:
                    self.tsc_mdf = rc.MDF_TASK_STATE_CONFIG()
                    copy_from_msg(self.tsc_mdf, msg)

                elif msg_type == rc.MT_ROBOT_CONTROL_SPACE_ACTUAL_STATE:
                    mdf = rc.MDF_ROBOT_CONTROL_SPACE_ACTUAL_STATE()
                    copy_from_msg(mdf, msg)

                    self.fdbk_actual_cori = mdf.CoriMatrix

                    self.fdbk_actual_pos = []
                    self.fdbk_actual_pos.extend(mdf.pos)
                    self.fdbk_actual_pos.extend(self.fdbk_percepts)
                    self.fdbk_actual_pos.extend(self.fdbk_torques)
                   
                    self.update_judging_data()

                elif msg_type == rc.MT_GROBOT_SEGMENT_PERCEPTS:
                    mdf = rc.MDF_GROBOT_SEGMENT_PERCEPTS()
                    copy_from_msg(mdf, msg)
                    self.fdbk_percepts = []
                    self.fdbk_percepts.extend(mdf.ind_force[:])
                    self.fdbk_percepts.extend(mdf.mid_force[:]) 
                    self.fdbk_percepts.extend(mdf.rng_force[:]) 
                    self.fdbk_percepts.extend(mdf.lit_force[:]) 
                    self.fdbk_percepts.extend(mdf.thb_force[:])

                elif msg_type == rc.MT_GROBOT_RAW_FEEDBACK:
                    mdf = rc.MDF_GROBOT_RAW_FEEDBACK()
                    copy_from_msg(mdf, msg)
                    self.fdbk_torques = mdf.j_trq
                    
                elif msg_type == rc.MT_END_TASK_STATE:
                    self.ets_mdf = rc.MDF_END_TASK_STATE()
                    copy_from_msg(self.ets_mdf, msg)

                elif msg_type == rc.MT_PING:
                    respond_to_ping(self.mod, msg, 'SimpleJudgeDisplay')

                elif msg_type == MT_EXIT:
                    self.exit()
                    done = True
                    
            else:
                done = True

        self.update_plot()
Exemple #2
0
    def timer_event(self):
        done = False
        while not done:
            msg = CMessage()
            rcv = self.mod.ReadMessage(msg, 0)
            if rcv == 1:
                msg_type = msg.GetHeader().msg_type

                if msg_type == rc.MT_TASK_STATE_CONFIG:
                    self.tsc_mdf = rc.MDF_TASK_STATE_CONFIG()
                    copy_from_msg(self.tsc_mdf, msg)

                elif msg_type == rc.MT_ROBOT_CONTROL_SPACE_ACTUAL_STATE:
                    mdf = rc.MDF_ROBOT_CONTROL_SPACE_ACTUAL_STATE()
                    copy_from_msg(mdf, msg)

                    self.fdbk_actual_cori = mdf.CoriMatrix

                    self.fdbk_actual_pos = []
                    self.fdbk_actual_pos.extend(mdf.pos)
                    self.fdbk_actual_pos.extend(self.fdbk_percepts)
                    self.fdbk_actual_pos.extend(self.fdbk_torques)

                    self.update_judging_data()

                elif msg_type == rc.MT_GROBOT_SEGMENT_PERCEPTS:
                    mdf = rc.MDF_GROBOT_SEGMENT_PERCEPTS()
                    copy_from_msg(mdf, msg)
                    self.fdbk_percepts = []
                    self.fdbk_percepts.extend(mdf.ind_force[:])
                    self.fdbk_percepts.extend(mdf.mid_force[:])
                    self.fdbk_percepts.extend(mdf.rng_force[:])
                    self.fdbk_percepts.extend(mdf.lit_force[:])
                    self.fdbk_percepts.extend(mdf.thb_force[:])

                elif msg_type == rc.MT_GROBOT_RAW_FEEDBACK:
                    mdf = rc.MDF_GROBOT_RAW_FEEDBACK()
                    copy_from_msg(mdf, msg)
                    self.fdbk_torques = mdf.j_trq

                elif msg_type == rc.MT_END_TASK_STATE:
                    self.ets_mdf = rc.MDF_END_TASK_STATE()
                    copy_from_msg(self.ets_mdf, msg)

                elif msg_type == rc.MT_PING:
                    respond_to_ping(self.mod, msg, 'SimpleJudgeDisplay')

                elif msg_type == MT_EXIT:
                    self.exit()
                    done = True

            else:
                done = True

        self.update_plot()
Exemple #3
0
    def timer_event(self):
        done = False
        while not done:
            msg = CMessage()
            rcv = self.mod.ReadMessage(msg, 0)
            if rcv == 1:
                msg_type = msg.GetHeader().msg_type

                if msg_type == rc.MT_SPM_SPIKECOUNT:  #rc.MT_RAW_SPIKECOUNT: #rc.MT_SPM_SPIKECOUNT:
                    mdf = rc.MDF_SPM_SPIKECOUNT()
                    copy_from_msg(mdf, msg)
                    self.update_judging_data(mdf.counts)

                elif msg_type == rc.MT_PING:
                    respond_to_ping(self.mod, msg, 'SpikePlotter')

                #elif msg_type == MT_EXIT:
                #    self.exit()
                #    done = True

            else:
                done = True

        self.update_plot()
Exemple #4
0
    def timer_event(self):
        done = False
        while not done:
            msg = CMessage()
            rcv = self.mod.ReadMessage(msg, 0)
            if rcv == 1:
                msg_type = msg.GetHeader().msg_type

                if msg_type == rc.MT_SPM_SPIKECOUNT:  # rc.MT_RAW_SPIKECOUNT: #rc.MT_SPM_SPIKECOUNT:
                    mdf = rc.MDF_SPM_SPIKECOUNT()
                    copy_from_msg(mdf, msg)
                    self.update_judging_data(mdf.counts)

                elif msg_type == rc.MT_PING:
                    respond_to_ping(self.mod, msg, "SpikePlotter")

                # elif msg_type == MT_EXIT:
                #    self.exit()
                #    done = True

            else:
                done = True

        self.update_plot()