Here the code that does what you are requesting:
#!/usr/bin/env python
import rospy
from nav_msgs.msg import Odometry
from tf.transformations import euler_from_quaternion
from geometry_msgs.msg import Twist
import math
roll = pitch = yaw = 0.0
target_angle = 9
kP = 0.5
def get_rotation (msg):
global roll, pitch, yaw
orientation_q = msg.pose.pose.orientation
orientation_list = [orientation_q.x, orientation_q.y, orientation_q.z, orientation_q.w]
(roll, pitch, yaw) = euler_from_quaternion (orientation_list)
print yaw
rospy.init_node('my_quaternion_to_euler')
sub = rospy.Subscriber ('/odom', Odometry, get_rotation)
pub = rospy.Publisher('/cmd_vel', Twist, queue_size=1)
command= Twist()
r = rospy.Rate(10)
while not rospy.is_shutdown():
target_rad = target_angle * math.pi/180
command.angular.z = kP * (target_rad - yaw)
pub.publish(command)
r.sleep()
Set the desired angle in the variable target_angle
Also, if you need deeper explanation of the code check this video which describes the code step by step.
This question is too vague, what is the program you are referring to? What is the hardware setup of your robot. We need to know these things to be able to help you.
thank you for reply i modify my question to become more clear