Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/SimulationViewport.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ class SimulationViewport : public QOpenGLWindow {
public:
SimulationViewport(MujocoContext& mujContext);

void setCamerasEnabled(bool enabled) {
camerasEnabled_ = enabled;
}

void pauseRendering() {
if (timer) {
timer->stop();
Expand All @@ -39,6 +43,7 @@ class SimulationViewport : public QOpenGLWindow {
void keyPressEvent(QKeyEvent* event) override;

private:
bool camerasEnabled_ = true;
QPointF lastMousePosition;
mjtMouse mouseAction = mjMOUSE_NONE;

Expand Down
1 change: 1 addition & 0 deletions src/AppWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ void AppWindow::loadScene(const QString& yaml_file) {

mujContext = std::make_unique<MujocoContext>(xmlScene);
viewport = std::make_unique<SimulationViewport>(*mujContext);
viewport->setCamerasEnabled(publishImages_);

// Configure and bind GameController
GameController::instance().configure(parser.getSceneInfo().simulationConfig);
Expand Down
3 changes: 3 additions & 0 deletions src/SimulationViewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ void SimulationViewport::paintGL() {
mjv_updateScene(model, data, opt, nullptr, cam, mjCAT_ALL, scene);
mjr_render(viewport, scene, context);

if (!camerasEnabled_)
return;

// Render cameras offscreen and save images
for (int i = 0; i < RobotManager::instance().getRobots().size(); ++i) {
auto robot = RobotManager::instance().getRobots()[i];
Expand Down
Loading