Beispiel #1
0
def test_ptu():
    ptu = PTU("10.5.1.2", 4000)
    ptu.connect()
    print(1)
    ptu.slew_to_angle((0, 0))
    print(2)
    print(ptu.get_angle())
    time.sleep(3)
    print(3)
    ptu.slew_to_angle((10, 10))
    print(4)
    print(ptu.get_angle())
Beispiel #2
0
        ki = 1.2 * Ku / Tu
        kd = 3 * Ku * Tu / 40
    elif mode == "noovershoot":
        print("No Over Shoot")
        # No overshoot
        kp = Ku / 5
        ki = (2 / 5) * Ku / Tu
        kd = Ku * Tu / 15
    else:
        print("invaild mdoe")

    print("kp: ", kp, "ki: ", ki, "kd: ", kd)
    return [kp, ki, kd]


x = PTU("192.168.1.110", 4000, debug=False)
x.connect()

# x.reset()
# x.wait()

x.set_speed_mode()
x.wait()

# set upper speed limit
x.pan_speed_max(11448)
x.wait()

# # read accel
# x.pan_accel()
# x.wait()
Beispiel #3
0
#!/usr/bin/env python3

from flir_ptu.ptu import PTU
from vision_utils.logger import get_logger
from vision_utils.timing import get_timestamp
import time
logger = get_logger()

x = PTU("192.168.0.110", 4000, debug=False)
x.connect()

# reset PTU
# x.reset()
# x.wait()

# set upper speed limit
while (True):
    logger.debug(f"{get_timestamp()} pan: {x.pan()}")
    x.wait()
    logger.debug(f"{get_timestamp()} tilt: {x.tilt()}")
    x.wait()
    time.sleep(1)

x.stream.close()
Beispiel #4
0
#!/usr/bin/env python3

from flir_ptu.ptu import PTU
from vision_utils.logger import get_logger
import time
logger =  get_logger()


x = PTU("192.168.1.110", 4000, debug=False)
x.stream.close()
x.connect()


# reset PTU
x.reset()
x.wait()

import numpy as np
# set upper speed limit
x.pan_speed_max(16000)
x.wait()


import rospy
from sensor_msgs.msg import JointState

joint_msg = JointState()
joint_msg.name = ["ptu_panner", "ptu_tilter"]
rospy.init_node("ptu_joint_states_node")
pub = rospy.Publisher('joint_states', JointState, queue_size=1)
Beispiel #5
0
#!/usr/bin/env python3
import numpy as np
from flir_ptu.ptu import PTU
from vision_utils.logger import get_logger
import time
logger = get_logger()

x = PTU("192.168.1.110", 4000, debug=False)
x.connect()

# x.reset()
# x.wait()

# set upper speed limit
x.pan_speed_max(16000)
x.wait()

# read accel
x.pan_accel()
x.wait()

# x.tilt_speed()
# x.tilt_speed(2000)
# x.wait()

# x.pan_speed()
# x.pan_speed(2000)
# x.wait()

# x.set_speed_mode()
# x.wait()
Beispiel #6
0
#!/usr/bin/env python3
import numpy as np
from flir_ptu.ptu import PTU
from vision_utils.logger import get_logger
import time
logger = get_logger()

x = PTU("192.168.1.110", 4000, debug=False)
x.connect()

# x.reset()
# x.wait()

# set upper speed limit
x.pan_speed_max(11000)
x.wait()

x.set_position_mode()

x.pan_speed(2000)
x.wait()

x.tilt_speed(2000)
x.wait()

position = [0.0, 0.0]

angle = 200
tilt_angle = 200

Beispiel #7
0
#!/usr/bin/env python3
import rospy
from std_msgs.msg import Float32
from sensor_msgs.msg import JointState
from simple_pid import PID
import numpy as np
from flir_ptu.ptu import PTU
from vision_utils.logger import get_logger
import time
logger = get_logger()

x = PTU("192.168.1.110", 4000, debug=False)
x.connect()

x.reset()
x.wait()

# set upper speed limit
x.pan_speed_max(16000)
x.wait()

# read accel
x.pan_accel()
x.wait()

x.set_speed_mode()
x.wait()


def tune_gain(Ku, Tu, mode="clasic"):
    if mode == "clasic":
Beispiel #8
0
from flir_ptu.ptu import PTU
import logging


logger = logging.getLogger()
handler = logging.StreamHandler()
formatter = logging.Formatter('%(levelname)s:%(name)s:- %(message)s')
handler.setFormatter(formatter)
logger.addHandler(handler)

logger.setLevel(logging.DEBUG)

x = PTU("129.219.136.149", 4000)
x.connect()

value = 3

if value == 1:
    x.pan(25)
    print(x.pan())
elif value == 2:
    x.pan_angle(45)
    print(x.pan())
elif value == 3:
    x.pan_offset(-10)
    print("XX", x.pan())

x.stream.close()
Beispiel #9
0
#!/usr/bin/env python3

from flir_ptu.ptu import PTU
from vision_utils.logger import get_logger
import time
logger =  get_logger()

x = PTU("192.168.1.110", 4000, debug=False)
x.connect()

# reset PTU
x.reset()
x.wait()

# having fun with sines
import numpy as np
sin = np.arcsin(np.arange(-1,1.0,0.01)) * 180/np.pi
sin_inv = np.arcsin(np.arange(1.0,-1,0.01)) * 180/np.pi

# set upper speed limit
x.pan_speed_max(11000)
x.wait()

x.set_position_mode()
x.wait()

x.pan_speed(1000)
x.wait()

x.tilt_speed(1000)
x.wait()