This package is built around a small set of base classes and typed role interfaces that make it easy to load perception "drivers" as plugins.
fp_perception::DriverBase is the common base class for all perception plugins.
initialize(const rclcpp::Node::SharedPtr&): called after plugin construction (pluginlib creates objects with a default constructor). The default implementation callsinitialize_base(node).deinitialize(): pure virtual and must be implemented by every driver.test(): optional; default logs the driver name.
- If
use_diagnostics=trueon the server node, drivers can publish status on the standard ROS 2/diagnosticstopic viadiagnostic_updater. DriverBaseprovides the shared parameter read and updater/timer wiring; concrete drivers only populate their own health fields.
Server and pipeline code use typed interfaces:
AudioSourceDriver: microphone-like sources returningaudio_datachunks.AudioSinkDriver: speaker-like sinks acceptingaudio_dataplayback.TranscriptionDriver: transcription providers acceptingtranscription_request.SpeechSynthesisDriver: TTS providers acceptingtext_dataand returningaudio_data.SentimentAnalysisDriver: sentiment providers acceptingsentiment_request.VisionSourceDriver: camera-like sources returningvision_frame.ImageAnalysisDriver: image-analysis providers acceptingimage_analysis_request.
check_directory(folder): creates a directory if missing (used by driver tests).check_file(path): throws if file does not exist.
fp_perception::RestBase derives from DriverBase and provides a reusable REST client built on libcurl.
Drivers typically call:
initialize_rest_base(node, "<plugin_prefix>", "<ENV_KEY>")
This declares and loads common parameters under <plugin_prefix>.rest.*:
<plugin_prefix>.rest.uri(string)<plugin_prefix>.rest.method(string, e.g.POST)<plugin_prefix>.rest.ssl_verify(bool)<plugin_prefix>.rest.auth_type(string, currentlyBearer)
If ENV_KEY is provided, the API key is read from that environment variable (e.g. OPENAI_API_KEY, HUGGINGFACE_API_KEY).
RestBase provides:
call(req): JSON request/response. Requires the derived driver to implementtoJson()andfromJson().call_audio(req): multipart form upload (used for audio transcription).call_tts(req): JSON request that returns raw PCM audio (converted tostd::vector<int16_t>inRESTResponse::audio_stream).
RestBase does not implement deinitialize() (it remains pure via DriverBase). Any REST driver must implement deinitialize() to be instantiable by pluginlib.