#!/usr/bin/env python
"""
This python script demonstrates the utilization 
of custom message and the way of publishing them.
"""
#-*- encoding: utf-8 -*-
__author__ = 'shehzad ahmed'

import rospy
from custom_msg_example1.msg import NodeData

if __name__ == '__main__':
    '''
    Initilize node and string type publish topic at the loop rate.
    '''
    rospy.init_node('custom_msg_publisher_python_examples_node', anonymous=False)
    rospy.loginfo("custom_msg_publisher_python_examples_node is now running")

    node_data_pub = rospy.Publisher("~node_data", NodeData, queue_size=100)

    node_data = NodeData()
    node_data.vector_position.x = 0.01
    node_data.vector_position.y = 0.01
    node_data.vector_position.z = 0.01

    node_data.point_position.x = 0.1
    node_data.point_position.y = 0.2
    node_data.point_position.z = 0.01

    loop_rate = rospy.Rate(10)
    while not rospy.is_shutdown():
        node_data_pub.publish(node_data)
        loop_rate.sleep()