-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_lcm_import.py
More file actions
31 lines (25 loc) · 883 Bytes
/
test_lcm_import.py
File metadata and controls
31 lines (25 loc) · 883 Bytes
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
#!/usr/bin/env python3
"""
Test script to verify that LCM-generated message types can be imported
without conflicts with ROS packages.
"""
import sys
print(f"Python version: {sys.version}")
print(f"Python path: {sys.path}")
# Test importing from lcm_msgs namespace
print("\nTesting lcm_msgs imports:")
from lcm_msgs.sensor_msgs import JointState
from lcm_msgs.geometry_msgs import Pose
from lcm_msgs.std_msgs import String
print(" ✓ JointState imported successfully")
print(" ✓ Pose imported successfully")
print(" ✓ String imported successfully")
# Create and print a simple message
js = JointState()
js.name = ["joint1", "joint2"]
js.position = [0.1, 0.2]
js.name_length = len(js.name)
js.position_length = len(js.position)
print(f"\nCreated JointState message with {js.name_length} joints: {js.name}")
print(f"Positions: {js.position}")
print("\nAll tests passed!")