Skip to content

Commit c59c365

Browse files
committed
Finalize old-arm Arduino integration
1 parent 3c92c38 commit c59c365

16 files changed

Lines changed: 779 additions & 619 deletions

File tree

‎.vscode/c_cpp_properties.json‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
],
1212
"name": "ROS",
1313
"intelliSenseMode": "gcc-x64",
14-
"compilerPath": "/usr/bin/c++",
14+
"compilerPath": "/usr/bin/gcc",
1515
"cStandard": "gnu11",
16-
"cppStandard": "c++17",
17-
"compileCommands": "${workspaceFolder}/build/waybionic_rviz_plugins/compile_commands.json"
16+
"cppStandard": "c++14"
1817
}
1918
],
2019
"version": 4

‎.vscode/settings.json‎

Lines changed: 114 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,115 @@
11
{
2-
"files.associations": {
3-
"*.msg": "plaintext",
4-
"*.tcc": "cpp",
5-
"cctype": "cpp",
6-
"clocale": "cpp",
7-
"cmath": "cpp",
8-
"csignal": "cpp",
9-
"cstdarg": "cpp",
10-
"cstddef": "cpp",
11-
"cstdio": "cpp",
12-
"cstdlib": "cpp",
13-
"cstring": "cpp",
14-
"ctime": "cpp",
15-
"cwchar": "cpp",
16-
"cwctype": "cpp",
17-
"any": "cpp",
18-
"array": "cpp",
19-
"atomic": "cpp",
20-
"strstream": "cpp",
21-
"bit": "cpp",
22-
"bitset": "cpp",
23-
"chrono": "cpp",
24-
"codecvt": "cpp",
25-
"compare": "cpp",
26-
"complex": "cpp",
27-
"concepts": "cpp",
28-
"condition_variable": "cpp",
29-
"coroutine": "cpp",
30-
"cstdint": "cpp",
31-
"deque": "cpp",
32-
"forward_list": "cpp",
33-
"list": "cpp",
34-
"map": "cpp",
35-
"set": "cpp",
36-
"string": "cpp",
37-
"unordered_map": "cpp",
38-
"unordered_set": "cpp",
39-
"vector": "cpp",
40-
"exception": "cpp",
41-
"algorithm": "cpp",
42-
"functional": "cpp",
43-
"iterator": "cpp",
44-
"memory": "cpp",
45-
"memory_resource": "cpp",
46-
"numeric": "cpp",
47-
"optional": "cpp",
48-
"random": "cpp",
49-
"ratio": "cpp",
50-
"regex": "cpp",
51-
"source_location": "cpp",
52-
"string_view": "cpp",
53-
"system_error": "cpp",
54-
"tuple": "cpp",
55-
"type_traits": "cpp",
56-
"utility": "cpp",
57-
"fstream": "cpp",
58-
"future": "cpp",
59-
"initializer_list": "cpp",
60-
"iomanip": "cpp",
61-
"iosfwd": "cpp",
62-
"iostream": "cpp",
63-
"istream": "cpp",
64-
"limits": "cpp",
65-
"mutex": "cpp",
66-
"new": "cpp",
67-
"numbers": "cpp",
68-
"ostream": "cpp",
69-
"semaphore": "cpp",
70-
"shared_mutex": "cpp",
71-
"sstream": "cpp",
72-
"stdexcept": "cpp",
73-
"stop_token": "cpp",
74-
"streambuf": "cpp",
75-
"thread": "cpp",
76-
"cfenv": "cpp",
77-
"cinttypes": "cpp",
78-
"typeindex": "cpp",
79-
"typeinfo": "cpp",
80-
"variant": "cpp",
81-
"*.ipp": "cpp",
82-
"callback": "cpp",
83-
"image": "cpp",
84-
"bufferobject": "cpp",
85-
"mixinvector": "cpp",
86-
"texture": "cpp",
87-
"vertexarraystate": "cpp",
88-
"buffered_value": "cpp",
89-
"fast_back_stack": "cpp"
90-
},
91-
"ros.distro": "jazzy",
92-
"C_Cpp.default.includePath": [
93-
"/opt/ros/jazzy/include/**"
94-
],
95-
"C_Cpp.default.cppStandard": "c++17",
96-
"python.autoComplete.extraPaths": [
97-
"/opt/ros/jazzy/lib/python3.10/site-packages"
98-
],
99-
"python.analysis.extraPaths": [
100-
"/opt/ros/jazzy/lib/python3.10/site-packages"
101-
],
102-
"[python]": {
103-
"editor.defaultFormatter": "eeyore.yapf",
104-
},
105-
"editor.formatOnSave": true,
106-
"editor.tabSize": 2,
107-
"files.exclude": {
108-
"build": true,
109-
"install": true,
110-
"log": true
111-
},
112-
"cSpell.words": [
113-
"RCLCPP"
114-
],
115-
"cmake.ignoreCMakeListsMissing": true
116-
}
2+
"files.associations": {
3+
"*.msg": "plaintext",
4+
"*.tcc": "cpp",
5+
"cctype": "cpp",
6+
"clocale": "cpp",
7+
"cmath": "cpp",
8+
"csignal": "cpp",
9+
"cstdarg": "cpp",
10+
"cstddef": "cpp",
11+
"cstdio": "cpp",
12+
"cstdlib": "cpp",
13+
"cstring": "cpp",
14+
"ctime": "cpp",
15+
"cwchar": "cpp",
16+
"cwctype": "cpp",
17+
"any": "cpp",
18+
"array": "cpp",
19+
"atomic": "cpp",
20+
"strstream": "cpp",
21+
"bit": "cpp",
22+
"bitset": "cpp",
23+
"chrono": "cpp",
24+
"codecvt": "cpp",
25+
"compare": "cpp",
26+
"complex": "cpp",
27+
"concepts": "cpp",
28+
"condition_variable": "cpp",
29+
"coroutine": "cpp",
30+
"cstdint": "cpp",
31+
"deque": "cpp",
32+
"forward_list": "cpp",
33+
"list": "cpp",
34+
"map": "cpp",
35+
"set": "cpp",
36+
"string": "cpp",
37+
"unordered_map": "cpp",
38+
"unordered_set": "cpp",
39+
"vector": "cpp",
40+
"exception": "cpp",
41+
"algorithm": "cpp",
42+
"functional": "cpp",
43+
"iterator": "cpp",
44+
"memory": "cpp",
45+
"memory_resource": "cpp",
46+
"numeric": "cpp",
47+
"optional": "cpp",
48+
"random": "cpp",
49+
"ratio": "cpp",
50+
"regex": "cpp",
51+
"source_location": "cpp",
52+
"string_view": "cpp",
53+
"system_error": "cpp",
54+
"tuple": "cpp",
55+
"type_traits": "cpp",
56+
"utility": "cpp",
57+
"fstream": "cpp",
58+
"future": "cpp",
59+
"initializer_list": "cpp",
60+
"iomanip": "cpp",
61+
"iosfwd": "cpp",
62+
"iostream": "cpp",
63+
"istream": "cpp",
64+
"limits": "cpp",
65+
"mutex": "cpp",
66+
"new": "cpp",
67+
"numbers": "cpp",
68+
"ostream": "cpp",
69+
"semaphore": "cpp",
70+
"shared_mutex": "cpp",
71+
"sstream": "cpp",
72+
"stdexcept": "cpp",
73+
"stop_token": "cpp",
74+
"streambuf": "cpp",
75+
"thread": "cpp",
76+
"cfenv": "cpp",
77+
"cinttypes": "cpp",
78+
"typeindex": "cpp",
79+
"typeinfo": "cpp",
80+
"variant": "cpp",
81+
"*.ipp": "cpp",
82+
"callback": "cpp",
83+
"image": "cpp",
84+
"bufferobject": "cpp",
85+
"mixinvector": "cpp",
86+
"texture": "cpp",
87+
"vertexarraystate": "cpp",
88+
"buffered_value": "cpp",
89+
"fast_back_stack": "cpp"
90+
},
91+
"ros.distro": "jazzy",
92+
"C_Cpp.default.includePath": [
93+
"/opt/ros/jazzy/include/**"
94+
],
95+
"C_Cpp.default.cppStandard": "c++17",
96+
"python.autoComplete.extraPaths": [
97+
"/opt/ros/jazzy/lib/python3.10/site-packages"
98+
],
99+
"python.analysis.extraPaths": [
100+
"/opt/ros/jazzy/lib/python3.10/site-packages"
101+
],
102+
"[python]": {
103+
"editor.defaultFormatter": "eeyore.yapf",
104+
},
105+
"editor.formatOnSave": true,
106+
"editor.tabSize": 2,
107+
"files.exclude": {
108+
"build": true,
109+
"install": true,
110+
"log": true
111+
},
112+
"cSpell.words": [
113+
"RCLCPP"
114+
]
115+
}

‎docs/arm_hardware_motion_architecture.md‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ accepts the existing `/old_arm_motion_test/command` topic. It translates
123123
`RUN`, `HOME`, and `STOP` into the firmware protocol, publishes the estimated
124124
pose, and publishes connection/command status on `/diagnostics`.
125125

126+
The initial and HOME pose is the calibrated upright pose: physical servo
127+
angles `[90.0, 35.0, 151.5, 27.5]`, corresponding to model joint angles
128+
`[0, 90, 0, 0]` degrees. The manual joint-state stepper is opt-in so it does
129+
not overwrite this upright motion-test state by publishing zero positions.
130+
126131
## Package Responsibilities
127132

128133
### `waybionic_description`
@@ -181,9 +186,11 @@ It must not publish synthetic `/joint_states` in physical mode.
181186
Arduino-reported fault.
182187
5. Treat the stop command as cancellation plus a hardware stop request; do not
183188
merely stop publishing messages.
184-
6. Require an explicit physical-mode launch argument so a development launch
189+
6. A latched bridge fault ignores subsequent `READY` messages and can only be
190+
cleared by restarting the bridge; inspect the reported fault before doing so.
191+
7. Require an explicit physical-mode launch argument so a development launch
185192
cannot move the arm accidentally.
186-
7. Keep the first physical test at low speed with one joint at a time before
193+
8. Keep the first physical test at low speed with one joint at a time before
187194
running synchronized trajectories.
188195

189196
## Incremental Implementation Plan

‎groundstation.zip‎

-238 KB
Binary file not shown.

‎waybionic_bringup/launch/display.launch.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,16 @@ def generate_launch_description():
7070
arguments=['-d', LaunchConfiguration('rvizconfig')],
7171
)
7272

73+
joint_state_publisher_gui_node = Node(
74+
package='joint_state_publisher_gui',
75+
executable='joint_state_publisher_gui',
76+
name='joint_state_publisher_gui',
77+
)
78+
7379
return LaunchDescription([
7480
model_arg,
7581
rviz_arg,
7682
OpaqueFunction(function=_launch_nodes),
83+
joint_state_publisher_gui_node,
7784
rviz_node,
7885
])

‎waybionic_bringup/launch/old_arm.launch.py‎

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
from ament_index_python.packages import get_package_share_directory
66
from launch import LaunchDescription
77
from launch.actions import DeclareLaunchArgument, GroupAction, IncludeLaunchDescription
8+
from launch.conditions import IfCondition
89
from launch.launch_description_sources import PythonLaunchDescriptionSource
9-
from launch.substitutions import LaunchConfiguration
10-
from launch_ros.actions import PushRosNamespace, SetRemap
10+
from launch.substitutions import LaunchConfiguration, PythonExpression
11+
from launch_ros.actions import Node, PushRosNamespace, SetRemap
1112

1213

1314
def generate_launch_description():
@@ -23,8 +24,10 @@ def generate_launch_description():
2324
'joint_states_topic', default_value='/old_arm/joint_states',
2425
description='sensor_msgs/JointState input, with named model joints in radians'),
2526
DeclareLaunchArgument(
26-
'use_joint_state_publisher_gui', default_value='true',
27-
description='Set false when a live joint-state source is connected'),
27+
'use_joint_state_publisher_gui', default_value='false',
28+
description=(
29+
'Opt into the manual joint stepper instead of the upright '
30+
'motion-test source')),
2831
DeclareLaunchArgument(
2932
'launch_rviz', default_value='true',
3033
description='Set false for headless transform validation'),
@@ -37,6 +40,24 @@ def generate_launch_description():
3740
DeclareLaunchArgument(
3841
'diagnostics_topic', default_value='/diagnostics',
3942
description='DiagnosticArray input for the Engineering Monitor'),
43+
DeclareLaunchArgument(
44+
'start_motion_test', default_value='true',
45+
description='Start the old-arm motion test node'),
46+
DeclareLaunchArgument(
47+
'motion_test_segment_duration', default_value='3.0',
48+
description='Seconds for each synchronized motion segment'),
49+
DeclareLaunchArgument(
50+
'hardware_mode', default_value='simulation',
51+
description='Arm mode: simulation or arduino'),
52+
DeclareLaunchArgument(
53+
'arduino_port', default_value='',
54+
description='Arduino serial port, for example /dev/ttyACM0'),
55+
DeclareLaunchArgument(
56+
'arduino_baud', default_value='115200',
57+
description='Arduino serial baud rate'),
58+
DeclareLaunchArgument(
59+
'arduino_dry_run', default_value='false',
60+
description='Run the Arduino bridge without opening a serial port'),
4061
]
4162
station = IncludeLaunchDescription(
4263
PythonLaunchDescriptionSource(
@@ -52,8 +73,43 @@ def generate_launch_description():
5273
'start_temporary_diagnostics_publisher': 'false',
5374
}.items(),
5475
)
76+
77+
motion_test_node = Node(
78+
package='waybionic_motion_test',
79+
executable='motion_test',
80+
name='old_arm_motion_test',
81+
output='screen',
82+
condition=IfCondition(PythonExpression([
83+
"'", LaunchConfiguration('start_motion_test'), "' == 'true' and '",
84+
LaunchConfiguration('hardware_mode'), "' == 'simulation'"
85+
])),
86+
parameters=[
87+
{'segment_duration': LaunchConfiguration(
88+
'motion_test_segment_duration')}
89+
],
90+
)
91+
92+
arduino_bridge_node = Node(
93+
package='waybionic_hardware',
94+
executable='arduino_bridge',
95+
name='waybionic_arduino_bridge',
96+
output='screen',
97+
condition=IfCondition(PythonExpression([
98+
"'", LaunchConfiguration('hardware_mode'), "' == 'arduino'"
99+
])),
100+
parameters=[
101+
{'port': LaunchConfiguration('arduino_port')},
102+
{'baud': LaunchConfiguration('arduino_baud')},
103+
{'segment_duration': LaunchConfiguration(
104+
'motion_test_segment_duration')},
105+
{'dry_run': LaunchConfiguration('arduino_dry_run')},
106+
],
107+
)
108+
55109
return LaunchDescription(arguments + [GroupAction([
56110
PushRosNamespace('old_arm'),
57111
SetRemap(src='joint_states', dst=LaunchConfiguration('joint_states_topic')),
58112
station,
113+
motion_test_node,
114+
arduino_bridge_node,
59115
])])

‎waybionic_bringup/test/test_ground_station_launch.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from ament_index_python.packages import get_package_share_directory
66
import launch
7-
from launch.actions import IncludeLaunchDescription
7+
from launch.actions import IncludeLaunchDescription, SetEnvironmentVariable
88
from launch.launch_description_sources import PythonLaunchDescriptionSource
99
import launch_testing
1010
import launch_testing.actions
@@ -26,6 +26,7 @@ def generate_test_description():
2626
)
2727

2828
return launch.LaunchDescription([
29+
SetEnvironmentVariable('ROS_DOMAIN_ID', '71'),
2930
ground_station_launch,
3031
launch_testing.actions.ReadyToTest()
3132
])

0 commit comments

Comments
 (0)