Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Benchmark.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

sudo apt-get install sysbench mbw -y
dd if=/dev/zero of=/tmp/output bs=8k count=1000k >& results.txt
sed -i '1s/^/\n\nDisk Write-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ \n\n/' results.txt
rm -f /tmp/output
echo -e "\n\nDisk Read-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ \n" >> results.txt
sudo hdparm -Tt /dev/sda >> results.txt
echo -e "\n\nRAM Access-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ \n" >> results.txt
mbw -n 2 2000 >> results.txt
echo -e "\n\nCPU Single Thread Performance-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n" >> results.txt
sysbench --test=cpu --num-threads=1 --cpu-max-prime=50000 run >> results.txt
echo -e "\n\nCPU Multi Thread Performance-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_ \n" >> results.txt
sysbench --test=cpu --num-threads=8 --cpu-max-prime=50000 run >> results.txt
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,19 @@ ros-helper-scripts
* (don't forget the "." or the variable setting will not take effect)
* ws: run a command in all subdirectories of your catkin workspace src/ directory
* Usage: ws COMMAND
* (I do things like ws git branch or ws git status to see the state of all my repositories at once)
* (I do things like ws git branch or ws git status to see the state of all my repositories at once)
* netSearch.py: search selected segments of the local network for ROS Master, present to user, and offer use of rosremote.sh
* Usage: netSearch.py 192.168.1.*
* Placing the * symbol will search that entire subnet address, from 0-255
* rosBWMonitor.sh: get the bandwidth usage and rate of all rostopics on a ros master.
* Usage: ./rosBWMonitor.sh
* Note: Should be run on whatever system would receive the data, for example a laptop on wifi.
* To pipe to a CSV (for later analysis) use: ./rosBWMonitor.sh >> topics.csv
* Benchmark.bash : automatically installs dependacies and runs a simple benchmark to quickly get data about a computer


* Also of interest:
* Alias the rosdep command to ease use:
* alias rosdepquick="rosdep install --from-paths src --ignore-src --rosdistro=indigo -y"


30 changes: 30 additions & 0 deletions netSearch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#! /usr/bin/env python
import socket
import sys

if len(sys.argv) > 1:
ip = sys.argv[1]
add = ip.split('.')
port = 11311

for n1 in range (0 if (add[0] == '*') else int(add[0]),256 if (add[0] == '*') else int(add[0])+1):
for n2 in range (0 if (add[1] == '*') else int(add[1]),256 if (add[1] == '*') else int(add[1])+1):
for n3 in range (0 if (add[2] == '*') else int(add[2]),256 if (add[2] == '*') else int(add[2])+1):
for n4 in range (0 if (add[3] == '*') else int(add[3]),256 if (add[3] == '*') else int(add[3])+1):
ip = str(n1) + '.' + str(n2) + '.' + str(n3) + '.' + str(n4)

try:
s = socket.socket()
s.settimeout(0.05)
s.connect((ip,port))
s.send("\r\n\r\n")
result = s.recv(16) #See if we get any response at all
s.close()
print "ROS Master at: " + ip

except Exception, e:
pass
else:
print "Usage: netSearch.py 192.168.1.*"
print "Placing the * symbol will search that entire subnet address, from 0-255"

31 changes: 31 additions & 0 deletions rosBWMonitor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#! /bin/bash

mapfile -t lines < <(rostopic list)
now=$(date)
host=$(hostname)
ip=$(ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
echo $now
echo "Topic, Bandwidth, Rate, Published Locally?, Subscribed Locally?"
for (( i=0; i<${#lines[@]}; i++ )); do
echo -n ${lines[i]} ", "
read VAL1 <<< $(timeout 1s rostopic bw ${lines[i]} | awk '/average:/ { print $0}')
echo -n ${VAL1} ", "
read VAL1 <<< $(timeout 1s rostopic hz ${lines[i]} | awk '/rate:/ { print $0}')
echo -n ${VAL1} ", "
read VAL1 <<< $(rostopic info ${lines[i]})
read VAL1 <<< $(rostopic info ${lines[i]})
VAL1=${VAL1//'*'/-} # Bodge to prevent * from throwing everything
sub=${VAL1##*'Subscribers:'}
pub=${VAL1##*'Publishers:'}
pub=${pub%%'Subscribers:'*}
if [[ $pub = *$host* ]] || [[ $pub = *$ip* ]]; then
echo -n "yes, "
else
echo -n "no, "
fi
if [[ $sub = *$host* ]] || [[ $sub = *$ip* ]]; then
echo "yes"
else
echo "no"
fi
done
Loading