What is the optimal scan interval and wait time(time.sleep) for a very detailed scan?

asked 2017-11-20 06:01:26 -0600

Mekateng gravatar image

I obtained 3d pointcloud image using 2d laserscanner using servo. But the image obtained at the end of the scan is not very detailed. What is the optimal scan interval and wait time(time.sleep) for a very detailed scan? my code:

#!/usr/bin/env python
import rospy
from sensor_msgs.msg import JointState
from std_msgs.msg import Header
import numpy as np
import time

def servo_angle_control():
    pub=rospy.Publisher('joint_states',JointState,queue_size=10)
    rospy.init_node('joint_state_publisher')
    r=rospy.Rate(10)
    angle_pos=np.arange(0.0,6.28,0.00398)
    angle_neg=np.arange(6.28,0.0,-0.008)
    angle=JointState()
    angle.header=Header()
    angle.name=['base_tilt_joint']
angle.velocity=[]
angle.effort=[]
while not rospy.is_shutdown():
    for i in angle_pos:
        angle.header.stamp=rospy.Time.now()
        angle.position=[i]
        pub.publish(angle)
        time.sleep(0.01)
    for i in angle_neg:
        angle.header.stamp=rospy.Time.now()
        angle.position=[i]
        pub.publish(angle)
        time.sleep(0.01)
    r.sleep()

if __name__=='__main__':
    try:
        servo_angle_control()
    except rospy.ROSInterruptException:
        pass
edit retag flag offensive close merge delete