Beispiel #1
0
    def get_pots(self):
        """
       Seperates Pot data
       :return: Pot data
       :rtype: Dict
        """
        left_leg = self.exoskeleton.left_leg
        right_leg = self.exoskeleton.right_leg

        left = []
        right = []
        count = 0

        for inc in self.exo_set_points:
            left_data = np.array(
                [[left_leg.hip.pot.get_values()[inc[0]:inc[1]]],
                 [left_leg.knee.pot.get_values()[inc[0]:inc[1]]],
                 [left_leg.ankle.pot.get_values()[inc[0]:inc[1]]]])

            right_data = np.array(
                [[right_leg.hip.pot.get_values()[inc[0]:inc[1]]],
                 [right_leg.knee.pot.get_values()[inc[0]:inc[1]]],
                 [right_leg.ankle.pot.get_values()[inc[0]:inc[1]]]])

            time = (len(left_data) / float(self.exoskeleton.length)) * self.dt

            stamp_left = Data.Data()
            stamp_right = Data.Data()
            stamp_right.data = right_data
            stamp_left.data = left_data
            stamp_left.time = np.linspace(0, time, len(left_data))
            stamp_right.time = np.linspace(0, time, len(right_data))

            if self._use_black_list:
                if count in self._black_list:
                    continue
                else:
                    left.append(stamp_left)
                    right.append(stamp_right)
            count += 1

        side = Side.Side(left, right)
        return side
Beispiel #2
0
    def get_FSRs(self):
        """
               Seperates FSR data
               :return: FSR data
               :rtype: Dict
        """

        left_fsr = self.exoskeleton.left_leg.ankle.FSRs
        right_fsr = self.exoskeleton.right_leg.ankle.FSRs

        left = []
        right = []

        for inc in self.exo_set_points:
            left_data = np.array([[left_fsr[0].get_values()[inc[0]:inc[1]]],
                                  [left_fsr[1].get_values()[inc[0]:inc[1]]],
                                  [left_fsr[2].get_values()[inc[0]:inc[1]]]])

            right_data = np.array([[right_fsr[0].get_values()[inc[0]:inc[1]]],
                                   [right_fsr[1].get_values()[inc[0]:inc[1]]],
                                   [right_fsr[2].get_values()[inc[0]:inc[1]]]])

            time = (len(left_data) / float(self.exoskeleton.length)) * self.dt
            stamp_left = Data.Data(left_data,
                                   np.linspace(0, time, len(left_data)))
            stamp_right = Data.Data(right_data,
                                    np.linspace(0, time, len(right_data)))

            # if self._use_black_list:
            #     if count in self._black_list:
            #         continue
            #     else:
            #         left.append(stamp_left)
            #         right.append(stamp_right)
            #
            # count += 1

        side = Side.Side(left, right)

        return side
Beispiel #3
0
    def get_CoPs(self):
        """
       Seperates then CoP data
       :return: CoP data
       :rtype: Dict
        """

        left = []
        right = []
        count = 0
        left_cop = self.exoskeleton.left_leg.calc_CoP()
        right_cop = self.exoskeleton.right_leg.calc_CoP()

        left = []
        right = []

        for inc in self.exo_set_points:
            left_data = left_cop[inc[0]:inc[1]]
            right_data = right_cop[inc[0]:inc[1]]

            time = (len(left_data) / float(self.exoskeleton.length)) * self.dt
            stamp_left = Data.Data(left_data,
                                   np.linspace(0, time, len(left_data)))
            stamp_right = Data.Data(right_data,
                                    np.linspace(0, time, len(right_data)))

            if self._use_black_list:
                if count in self._black_list:
                    continue
                else:
                    left.append(stamp_left)
                    right.append(stamp_right)

            count += 1

        side = Side.Side(left, right)

        return side
Beispiel #4
0
    def get_joint_trajectories(self):
        """
        Seperates then joint trajs data
        :return: joint trajectory data
        :rtype: Dict
        """
        joints = {}
        count = 0
        model = self.vicon.get_model_output()
        for fnc, side in zip((model.get_left_leg(), model.get_right_leg()),
                             ("L", "R")):
            for joint_name in ["_hip", "_knee", "_ankle"]:
                name = side + joint_name[1:]
                joints[name] = []
                for inc in self.vicon_set_points:
                    time = np.linspace(0, 1, (inc[1] - inc[0]))
                    current_joint = fnc.__dict__[joint_name]

                    angleX = Data.Data(
                        np.array(current_joint.angle.x[inc[0]:inc[1]]), time)
                    angleY = Data.Data(
                        np.array(current_joint.angle.y[inc[0]:inc[1]]), time)
                    angleZ = Data.Data(
                        np.array(current_joint.angle.z[inc[0]:inc[1]]), time)
                    angle = Point.Point(x=angleX, y=angleY, z=angleZ)

                    powerX = Data.Data(
                        np.array(current_joint.power.x[inc[0]:inc[1]]), time)
                    powerY = Data.Data(
                        np.array(current_joint.power.y[inc[0]:inc[1]]), time)
                    powerZ = Data.Data(
                        np.array(current_joint.power.z[inc[0]:inc[1]]), time)
                    power = Point.Point(x=powerX, y=powerY, z=powerZ)

                    torqueX = Data.Data(
                        np.array(current_joint.moment.x[inc[0]:inc[1]]), time)
                    torqueY = Data.Data(
                        np.array(current_joint.moment.y[inc[0]:inc[1]]), time)
                    torqueZ = Data.Data(
                        np.array(current_joint.moment.z[inc[0]:inc[1]]), time)
                    torque = Point.Point(x=torqueX, y=torqueY, z=torqueZ)

                    forceX = Data.Data(
                        np.array(current_joint.force.x[inc[0]:inc[1]]), time)
                    forceY = Data.Data(
                        np.array(current_joint.force.y[inc[0]:inc[1]]), time)
                    forceZ = Data.Data(
                        np.array(current_joint.force.z[inc[0]:inc[1]]), time)
                    force = Point.Point(forceX, forceY, forceZ)

                    stamp = Joint.Joint(angle, force, torque, power)
                    if self._use_black_list:
                        if count in self._black_list:
                            continue
                    joints[name].append(stamp)
                    count += 1

        left_leg = Leg.Leg(joints["Rhip"], joints["Rknee"], joints["Rankle"])
        right_leg = Leg.Leg(joints["Lhip"], joints["Lknee"], joints["Lankle"])
        body = Side.Side(left_leg, right_leg)
        return body