Skip to main content

ExtensionContext

The activate function's first argument is an ExtensionContext — this context allows you to extend Foxglove for your custom workflows.

export function activate(extensionContext: ExtensionContext) {
// ... call methods on the extensionContext to extend Foxglove
}

Methods

registerPanel()

registerPanel(params): void;

registerPanel adds a new panel to the Foxglove interface. To register a panel you provide a name and an initPanel function.

The initPanel function accepts a PanelExtensionContext argument, which contains properties and methods for accessing panel data and rendering UI updates. It also returns an optional cleanup function to run when the extension panelElement unmounts.

See the Creating a custom panel guide for more details.

Parameters

ParameterType
paramsExtensionPanelRegistration

Returns

void


registerMessageConverter()

Call Signature

registerMessageConverter(args): void;

registerMessageConverter registers converters to transform message data within Foxglove.

You can register two kinds of converters: schema and topic.

schema converters transform messages of one schema into another. Most often this is used to turn messages using a custom or proprietary schema into a well-known Foxglove schema for visualization in one of the built-in panels. schema converters allow a built-in panel which requires well-known messages to natively support visualizing any topic for which there is a schema converter registered. An example is converting an acme.Gps message to foxglove.LocationFix to visualize any topics which publish acme.Gps messages in the built-in map panel.

See: RegisterMessageConverterArgsSchema.

topic converters transform messages from one-or-more input topics to a new in-app topic. Topic converters are more flexible than schema converters but require more logic and decisions to implement. They can transform existing data into new topics for plotting, inspecting, and visualizing. Topic converters can combine data from several input topics, maintain state, and create messages from these multiple topics. They can also do the opposite

  • take a single topic and turn it into multiple output topics.

See: RegisterMessageConverterArgsTopic.

Parameters
ParameterType
argsRegisterMessageConverterArgs
Returns

void

Call Signature

registerMessageConverter<Src>(args): void;
Type Parameters
Type Parameter
Src
Parameters
ParameterType
argsLegacyRegisterMessageConverterArgs<Src>
Returns

void

Deprecated

Use registerMessageConverter with type: "schema" or type: "topic" instead.

Call Signature

registerMessageConverter<Src>(args): void;

Register a schema message converter.

See: RegisterMessageConverterArgsSchema.

Type Parameters
Type Parameter
Src
Parameters
ParameterType
argsRegisterMessageConverterArgsSchema<Src>
Returns

void

Call Signature

registerMessageConverter(args): void;

Register a topic message converter.

See: RegisterMessageConverterArgsTopic.

Parameters
ParameterType
argsRegisterMessageConverterArgsTopic
Returns

void


registerTopicAliases()

registerTopicAliases(aliasFunction): void;

registerTopicAliases registers a function to compute topic aliases. The provided alias function should accept an argument with two fields – topics with the data source's original topics and globalVariables with the current layout's variables – and return a list of aliased topics.

Your alias function runs whenever there are changes to the data source topics or variables. Any aliases it returns are added to the data source topics (replacing any previously returned aliases) and available for subscribing or use within message paths as if they were real topics.

Parameters

ParameterType
aliasFunctionTopicAliasFunction

Returns

void