bob_flux2k.flux2k_node

Classes

Flux2Knode

A ROS node that interfaces with the FLUX.2-klein model for text-to-image

Functions

main([args])

Main entry point for the Flux2K ROS 2 node.

Module Contents

class bob_flux2k.flux2k_node.Flux2Knode

Bases: rclpy.node.Node

A ROS node that interfaces with the FLUX.2-klein model for text-to-image and image-to-image generation.

bridge
repo_id
model_dir
device
image_path
prompt
seed
input_image
once
image_counter
height
width
torch_dtype
pipe = None
current_repo_id = None
current_cpu_offload = None
subscription
image_pub
_initial_prompt_timer_callback()

One-shot timer callback to process the initial prompt after the node has initialized.

_parse_prompt(msg_data)

Parses the incoming prompt message. Supports plain text or a JSON string like: {“content”: “…”, “image_url”: “…”}

_load_input_image(image_input)

Loads an image from a URL, local file path, or base64 data string.

_get_image_output_path()

Generates the output path for the generated image. If image_path ends with ‘auto’, generates a unique filename with a counter and random suffix.

prompt_callback(msg)

Callback for the ‘prompt’ subscription. Parses the prompt (supports JSON for dynamic ITI), loads or clears the model as needed, runs the inference, saves the result, and publishes the image.

bob_flux2k.flux2k_node.main(args=None)

Main entry point for the Flux2K ROS 2 node.