-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathrun_lcm_spy.sh
More file actions
executable file
·72 lines (61 loc) · 2.11 KB
/
run_lcm_spy.sh
File metadata and controls
executable file
·72 lines (61 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# Script to run lcm-spy with the necessary Java classpath
# Works cross-platform by searching common LCM installation directories
# Function to find the LCM jar file
find_lcm_jar() {
# Try common locations for macOS
if [ "$(uname)" == "Darwin" ]; then
# Check Homebrew location
BREW_JAR=$(find /opt/homebrew/share/java -name "lcm*.jar" 2>/dev/null)
if [ ! -z "$BREW_JAR" ]; then
echo "$BREW_JAR"
return 0
fi
# Check MacPorts location
MAC_JAR=$(find /opt/local/share/java -name "lcm*.jar" 2>/dev/null)
if [ ! -z "$MAC_JAR" ]; then
echo "$MAC_JAR"
return 0
fi
fi
# Try common Linux locations
LINUX_JAR=$(find /usr/local/share/java /usr/share/java -name "lcm*.jar" 2>/dev/null | head -1)
if [ ! -z "$LINUX_JAR" ]; then
echo "$LINUX_JAR"
return 0
fi
# Try Java installation directories
JAVA_JAR=$(find $JAVA_HOME/lib -name "lcm*.jar" 2>/dev/null | head -1)
if [ ! -z "$JAVA_JAR" ]; then
echo "$JAVA_JAR"
return 0
fi
# Try current directory and standard locations
LOCAL_JAR=$(find . -maxdepth 2 -name "lcm*.jar" 2>/dev/null | grep -v "lcm_types.jar" | head -1)
if [ ! -z "$LOCAL_JAR" ]; then
echo "$LOCAL_JAR"
return 0
fi
# Not found
return 1
}
# Find the LCM types jar
LCM_TYPES_JAR="java_lcm_msgs/lcm_types.jar"
if [ ! -f "$LCM_TYPES_JAR" ]; then
echo "Error: lcm_types.jar not found in java_lcm_msgs directory."
echo "Make sure to build it first using ./build_lcm_jar.sh and move it to the correct location."
exit 1
fi
# Find the LCM jar
LCM_JAR=$(find_lcm_jar)
if [ -z "$LCM_JAR" ]; then
echo "Error: Could not find LCM jar file on your system."
echo "Please install LCM or specify the path to lcm.jar manually:"
echo "CLASSPATH=/path/to/lcm.jar:lcm_types.jar lcm-spy"
exit 1
fi
echo "Found LCM jar: $LCM_JAR"
echo "Found LCM types jar: $LCM_TYPES_JAR"
# Run lcm-spy with the classpath
echo "Running LCM Spy..."
CLASSPATH="$LCM_JAR:$LCM_TYPES_JAR" lcm-spy "$@"