Commit 7efd2885 authored by Stormiix's avatar Stormiix
Browse files

Cleanup and pkg name update

parent b3c58b71
cmake_minimum_required(VERSION 2.8.3)
project(ros-ping360-sonar)
project(ping360_sonar)
## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)
......
# ros-ping360-sonar
# ping360_sonar
ROS package for Blue Robotics Ping360 Sonar
#!/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}"
......
#!/usr/bin/env python
from ping360 import main
import sys
from ping360_sonar import main
if __name__ == '__main__':
main()
\ No newline at end of file
<?xml version="1.0"?>
<package format="2">
<name>ros-ping360-sonar</name>
<name>ping360_sonar</name>
<version>0.0.0</version>
<description>The sonar-ping360 package</description>
......
#!/usr/bin/env python
from polarplot import main
from brping.definitions import *
from brping.pingmessage import *
from brping.device import PingDevice
from brping.ping1d import Ping1D
from brping.ping360 import Ping360
\ No newline at end of file
......@@ -3,11 +3,6 @@
# device.py
# A device API for devices implementing Blue Robotics ping-protocol
# ~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!
# THIS IS AN AUTOGENERATED FILE
# DO NOT EDIT
# ~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!~!
from brping import definitions
from brping import pingmessage
from collections import deque
......
#!/usr/bin/env python
import roslib
roslib.load_manifest('ros-ping360-sonar')
roslib.load_manifest('ping360_sonar')
from sensor import Ping360
import argparse
......@@ -19,26 +19,32 @@ def main():
parser.add_argument('--device', action="store", required=True, type=str, help="Ping device port.")
parser.add_argument('--baudrate', action="store", type=int, default=2000000, help="Ping device baudrate.")
parser.add_argument('--v', action="store", type=bool, default=False, help="Verbose")
parser.add_argument('--size', action="store", type=int, default=200, help="Length")
parser.add_argument('--size', action="store", type=int, default=200, help="Image Size")
args = parser.parse_args()
try:
rospy.init_node('ping360_node')
transmitFrequency = 1000
samplePeriod = 80
numberOfSample = 200
speedOfSound = 1450
length = args.size
step = 1
angle = 0
topic = "ping360_sonar"
queue_size= 1
p = Ping360(args.device, args.baudrate)
imagePub = rospy.Publisher(topic, Image, queue_size=queue_size)
bridge = CvBridge()
imagePub = rospy.Publisher('ping360_sonar', Image, queue_size=1)
print("Initialized: %s" % p.initialize())
if args.v:
print('Verbose Mode')
print(p.set_transmit_frequency(1000))
print(p.set_sample_period(80))
print(p.set_number_of_samples(200))
p.set_transmit_frequency(transmitFrequency)
p.set_sample_period(samplePeriod)
p.set_number_of_samples(numberOfSample)
max_range = 80*200*1450/2
step = 1
length = args.size
max_range = samplePeriod * numberOfSample * speedOfSound / 2
image = np.zeros((length, length, 1), np.uint8)
angle = 0
center = (float(length/2),float(length/2))
while not rospy.is_shutdown():
p.transmitAngle(angle)
......@@ -54,12 +60,9 @@ def main():
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
if args.v:
cv2.imshow("PolarPlot",image)
cv2.waitKey(27)
......
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