Example #1
0
    def parse(self, single_component_dictionary):
        if not self.check_fields_exist(single_component_dictionary,
                                       _expected_json_fields):
            return

        x = single_component_dictionary[_rcv.WW_SENSOR_VALUE_AXIS_X]
        y = single_component_dictionary[_rcv.WW_SENSOR_VALUE_AXIS_Y]

        (self._x, self._y) = wwMath.coords_json_to_api_pos(x, y)
        self._z = single_component_dictionary[_rcv.WW_SENSOR_VALUE_AXIS_Z]

        self._valid = True
Example #2
0
    def parse(self, single_component_dictionary):
        if not self.check_fields_exist(single_component_dictionary, _expected_json_fields):
            return

        x = single_component_dictionary[_rcv.WW_SENSOR_VALUE_AXIS_ROLL]
        y = single_component_dictionary[_rcv.WW_SENSOR_VALUE_AXIS_PITCH]
        z = single_component_dictionary[_rcv.WW_SENSOR_VALUE_AXIS_YAW]

        x, y = wwMath.coords_json_to_api_pos(x, y)

        self._x = math.degrees(x)
        self._y = math.degrees(y)
        self._z = math.degrees(z)

        self._valid = True
Example #3
0
    def test_coordinate_conversion(self):
        d = wwMath.coords_api_to_json_tilt(3.0)
        self.assertAlmostEqual(d, -3.0)

        d = wwMath.coords_api_to_json_pan(3.0)
        self.assertAlmostEqual(d, 3.0)

        x, y = wwMath.coords_api_to_json_pos(1.0, 2.0)
        self.assertAlmostEqual(x, 2.0)
        self.assertAlmostEqual(y, -1.0)

        d = wwMath.coords_json_to_api_tilt(3.0)
        self.assertAlmostEqual(d, -3.0)

        d = wwMath.coords_json_to_api_pan(3.0)
        self.assertAlmostEqual(d, 3.0)

        x, y = wwMath.coords_json_to_api_pos(1.0, 2.0)
        self.assertAlmostEqual(x, -2.0)
        self.assertAlmostEqual(y, 1.0)
Example #4
0
    def parse(self, single_component_dictionary):

        if not self.check_fields_exist(single_component_dictionary, _expected_json_fields):
            return

        x       = single_component_dictionary[_rcv.WW_SENSOR_VALUE_AXIS_X      ]
        y       = single_component_dictionary[_rcv.WW_SENSOR_VALUE_AXIS_Y      ]
        degrees = single_component_dictionary[_rcv.WW_SENSOR_VALUE_ANGLE_DEGREE]

        x, y    = wwMath.coords_json_to_api_pos(x, y)
        degrees = wwMath.coords_api_to_json_pan(degrees)

        self._x       = x
        self._y       = y
        self._degrees = degrees

        if _rcv.WW_SENSOR_VALUE_POSE_WATERMARK in single_component_dictionary:
            self._watermark_measured = single_component_dictionary[_rcv.WW_SENSOR_VALUE_POSE_WATERMARK]
            self._watermark_inferred = self._watermark_measured

        self._valid   = True