import logging; logger = logging.getLogger("morse." + __name__)

import morse.core.sensor

from morse.core.services import service, async_service
from morse.core import status
from morse.helpers.components import add_data, add_property

class Posetruth(morse.core.sensor.Sensor):
    
    _name = "Posetruth"
    _short_desc = "posetruth"

    add_data('x', 0.0, 'double', 'true x of the robot')
    add_data('y', 0.0, 'double', 'true y of the robot')
    add_data('z', 0.0, 'double', 'true z of the robot')

    def __init__(self, obj, parent=None):
        logger.info("%s initialization" % obj.name)
        # Call the constructor of the parent class
        morse.core.sensor.Sensor.__init__(self, obj, parent)

        logger.info('Component initialized')

    def default_action(self):


        self.local_data['x'] = self.position_3d.x 
        self.local_data['y'] = self.position_3d.y
        self.local_data['z'] = self.position_3d.z 

