Drake
Drake C++ Documentation
MeshcatParams Struct Reference

Detailed Description

The set of parameters for configuring Meshcat.

#include <drake/geometry/meshcat.h>

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...
 
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 "*").

◆ 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 7099).

Precondition
We require 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: