Commit b3c58b71 authored by Henrique Martinez's avatar Henrique Martinez
Browse files

works on python2

parent c8e2b8b9
#!/bin/bash
# for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do
# (
# syspath="${sysdevpath%/dev}"
# devname="$(udevadm info -q name -p $syspath)"
# [[ "$devname" == "bus/"* ]] && continue
# eval "$(udevadm info -q property --export -p $syspath)"
# [[ -z "$ID_SERIAL" ]] && continue
# echo "/dev/$devname - $ID_SERIAL"
# )
# done
for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do
(
syspath="${sysdevpath%/dev}"
devname="$(udevadm info -q name -p $syspath)"
[[ "$devname" == "bus/"* ]] && continue
eval "$(udevadm info -q property --export -p $syspath)"
[[ -z "$ID_SERIAL" ]] && continue
# echo "$ID_SERIAL"
if [ $ID_SERIAL == "FTDI_FT230X_Basic_UART_DO01F2RQ" ]; then
echo "$devname"
fi
)
done
#!/usr/bin/env python
from ping360 import main
import sys
if __name__ == '__main__':
main()
\ No newline at end of file
from . import polarplot.main as main
#!/usr/bin/env python
from polarplot import main
from brping.definitions import *
from brping.pingmessage import *
from brping.device import PingDevice
......
#!/usr/bin/env python
COMMON_ACK = 1
COMMON_NACK = 2
COMMON_ASCII_TEXT = 3
......
#!/usr/bin/env python3
#!/usr/bin/env python
# device.py
# A device API for devices implementing Blue Robotics ping-protocol
......
#!/usr/bin/env python3
#!/usr/bin/env python
# PingMessage.py
# Python implementation of the Blue Robotics 'Ping' binary message protocol
......
#!/usr/bin/env python
import roslib
roslib.load_manifest('ros-ping360-sonar')
......@@ -37,22 +39,27 @@ def main():
length = args.size
image = np.zeros((length, length, 1), np.uint8)
angle = 0
center = (length/2,length/2)
center = (float(length/2),float(length/2))
while not rospy.is_shutdown():
p.transmitAngle(angle)
data = bytearray(getattr(p,'_data'))
data_lst = [k for k in data]
linear_factor = len(data_lst)/center[0]
linear_factor = float(len(data_lst))/float(center[0])
for i in range(int(center[0])):
if(i < center[0]*max_range/max_range):
pointColor = data_lst[int(i*linear_factor-1)]
else:
pointColor = 0
for k in np.linspace(0,step,8*step):
image[int(center[0]+i*cos(2*pi*(angle+k)/400)), int(center[1]+i*sin(2*pi*(angle+k)/400)), 0] = pointColor
theta = 2*pi*(angle+k)/400.0
x = float(i)*cos(theta)
y = float(i)*sin(theta)
#print(x,y,theta)
image[int(center[0]+x)][int(center[1]+y)][0] = pointColor
angle = (angle + step) % 400
color = cv2.applyColorMap(image,cv2.COLORMAP_JET)
image = color
#color = cv2.applyColorMap(image,cv2.COLORMAP_JET)
#image = color
if args.v:
cv2.imshow("PolarPlot",image)
cv2.waitKey(27)
......@@ -65,6 +72,6 @@ def main():
def publish(image, imagePub, bridge):
try:
imagePub.publish(bridge.cv2_to_imgmsg(image, "bgr8"))
imagePub.publish(bridge.cv2_to_imgmsg(image, "mono8"))
except CvBridgeError as e:
print(e)
\ No newline at end of file
#!/usr/bin/env python3
#!/usr/bin/env python
# ping360.py
# A device API for the Blue Robotics Ping360 scanning sonar
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment