Drake
Drake C++ Documentation
MeshcatParams Struct Reference

Detailed Description

The set of parameters for configuring Meshcat.

#include <drake/geometry/meshcat_params.h>

Classes

struct  PropertyTuple
 A helper struct for the initial_properties params. More...
 

Public Member Functions

template<typename Archive >
void Serialize (Archive *a)
 Passes this object to an Archive. More...
 

Public Attributes

std::string host {"*"}
 Meshcat will listen only on the given hostname (e.g., "localhost"). More...
 
std::optional< intport {std::nullopt}
 Meshcat will listen on the given http port. More...
 
std::string web_url_pattern {"http://{host}:{port}"}
 The web_url_pattern may be used to change the web_url() (and therefore the ws_url()) reported by Meshcat. More...
 
std::vector< PropertyTupleinitial_properties
 Configures the initial conditions for Meshcat. More...
 
bool show_stats_plot {true}
 Determines whether or not to display the stats plot widget in the Meshcat user interface. More...
 

Member Function Documentation

◆ Serialize()

void Serialize ( Archive *  a)

Passes this object to an Archive.

Refer to YAML Serialization for background.

Member Data Documentation

◆ host

std::string host {"*"}

Meshcat will listen only on the given hostname (e.g., "localhost").

If "*" is specified, then it will listen on all interfaces. If empty, an appropriate default value will be chosen (currently "*").

◆ initial_properties

std::vector<PropertyTuple> initial_properties

Configures the initial conditions for Meshcat.

These properties will be applied immediately during construction. This can be used to change defaults such as background, lighting, etc.

In other words, instead calling the Meshcat() constructor and then immediately making a bunch of SetProperty(path, property, value) calls to configure the newly-created object, instead you can append those (path, property, value) to to this list, and the Meshcat() constructor will take care of it.

◆ port

std::optional<int> port {std::nullopt}

Meshcat will listen on the given http port.

If no port is specified, then it will listen on the first available port starting at 7000 (up to 7999). If port 0 is specified, it will listen on an arbitrary "ephemeral" port.

Precondition
We require port == 0 || port >= 1024.

◆ show_stats_plot

bool show_stats_plot {true}

Determines whether or not to display the stats plot widget in the Meshcat user interface.

This plot including realtime rate and WebGL render statistics.

◆ web_url_pattern

std::string web_url_pattern {"http://{host}:{port}"}

The web_url_pattern may be used to change the web_url() (and therefore the ws_url()) reported by Meshcat.

This may be useful in case Meshcat sits behind a firewall or proxy.

The pattern follows the std::format specification language, except that arg-id substitutions are performed using named arguments instead of positional indices.

There are two arguments available to the pattern:

  • {port} will be substituted with the Meshcat server's listen port number;
  • {host} will be substituted with this params structure's host field, or else with "localhost" in case the host was one of the placeholders for "all interfaces".

The documentation for this struct was generated from the following file: