feat(recorder): add simple mode for direct recording without HTTP RPC#49
Merged
feat(recorder): add simple mode for direct recording without HTTP RPC#49
Conversation
Greptile OverviewGreptile SummaryThis PR adds a simple mode ( Key Changes:
Issues Found:
Architecture: Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Main
participant AxonRecorder
participant Plugin
participant MCAP
participant WorkerPool
alt Simple Mode (--simple flag)
User->>Main: ./axon_recorder --simple --output file.mcap
Main->>Main: Parse CLI args (simple_mode=true)
Main->>Main: generate_timestamp_filename() if no --output
Main->>AxonRecorder: initialize(config)
AxonRecorder->>WorkerPool: Create worker thread pool
Main->>AxonRecorder: start()
AxonRecorder->>AxonRecorder: IDLE → READY transition
AxonRecorder->>Plugin: load() and init()
AxonRecorder->>MCAP: open(output_file)
AxonRecorder->>Plugin: setup_subscriptions()
AxonRecorder->>AxonRecorder: READY → RECORDING transition
AxonRecorder->>Plugin: start()
Main->>Main: Print "Recording started. Press Ctrl+C to stop."
loop Every 1 second
Main->>AxonRecorder: get_statistics()
AxonRecorder-->>Main: Statistics
Main->>User: Print live stats
end
User->>Main: Ctrl+C (SIGINT)
Main->>AxonRecorder: stop()
AxonRecorder->>Plugin: stop()
AxonRecorder->>MCAP: close()
Main->>User: Print final statistics
else HTTP RPC Mode (default)
User->>Main: ./axon_recorder --config config.yaml
Main->>Main: Parse CLI args (simple_mode=false)
Main->>AxonRecorder: initialize(config)
Main->>AxonRecorder: start_http_server()
AxonRecorder-->>Main: Server listening on port 8080
Main->>User: "Waiting for RPC commands"
User->>AxonRecorder: POST /rpc/config
AxonRecorder->>AxonRecorder: IDLE → READY transition
User->>AxonRecorder: POST /rpc/begin
AxonRecorder->>Plugin: load() and start()
AxonRecorder->>MCAP: open(dataset.path/task_id.mcap)
AxonRecorder->>AxonRecorder: READY → RECORDING transition
User->>AxonRecorder: POST /rpc/finish
AxonRecorder->>Plugin: stop()
AxonRecorder->>MCAP: close()
AxonRecorder->>AxonRecorder: RECORDING → IDLE transition
end
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
Please ensure your PR meets the following requirements:
make testormake docker-test)make format)print_usage())Summary
This PR adds a simple mode for direct recording without HTTP RPC server, allowing the recorder to start capturing data immediately via CLI instead of waiting for remote control commands.
Motivation
The HTTP RPC mode is designed for fleet management scenarios where a server controls multiple recorders remotely. However, for local development, testing, and simple recording tasks, starting an HTTP server and sending RPC commands is unnecessarily complex. Simple mode provides a streamlined workflow for these use cases.
Changes
Modified Files
--simpleand--outputCLI options, auto-generated timestamp filenames, and live statistics displaydataset.output_filefield and updated message types to ROS2 format--topic/--type, added simple mode examples)Key Changes
New CLI Options:
--simple: Enable simple mode (direct recording without HTTP RPC server)--output FILE: Specify output file path (optional, defaults to auto-generated timestamp)Removed CLI Options:
--topicand--typeoptions removed (topics now configured via config file only)Simple Mode Behavior:
--output my_recording.mcap→ Use specified filename--output→ Auto-generated asYYYYMMDD_HHMMSS.mcapConfiguration Changes:
dataset.output_filefield to default config YAMLsensor_msgs/msg/Imuinstead ofsensor_msgs/Imu)Type of Change
Impact Analysis
Breaking Changes
The
--topicand--typeCLI options have been removed. Users must now configure subscriptions via the config file. Migration:Before:
After:
# Create config file with subscriptions ./axon_recorder --simple --plugin ./ros2_plugin.so --config my_config.yamlBackward Compatibility
HTTP RPC mode remains fully backward compatible. The default behavior (without
--simple) is unchanged.Testing
Test Environment
Test Cases
Manual Testing Steps
Simple mode with auto-generated filename:
Expected: Recording starts immediately, output file named as
YYYYMMDD_HHMMSS.mcapSimple mode with custom output file:
Expected: Output file created at
/tmp/test.mcapSimple mode Ctrl+C stop:
Expected: Recording stops gracefully, final statistics displayed
HTTP RPC mode (backward compatibility):
Expected: HTTP server starts, waits for RPC commands (unchanged behavior)
Test Coverage
Screenshots / Recordings
N/A
Performance Impact
Documentation
--topic/--typeexamples, added simple mode examplesNote: Both README.md (CLI usage examples) and
axon_recorder.cpp(print_usage()function) were updated.Related Issues
Additional Notes
The simple mode is primarily intended for:
For production fleet deployments, HTTP RPC mode remains the recommended approach.
Reviewers
@greptile-apps
Notes for Reviewers
--topic/--typeoptions don't break existing workflowsChecklist for Reviewers