Drift

Product

xArm7 Button Press in MuJoCo, a Simple Interaction Task

Build an xArm7 button press simulation in MuJoCo with Drift. Press a button, trigger an indicator lamp, and return the robot home.

Drift TeamSep 10, 2026 · 3 min read

A button press is a simple robot interaction task. Drift builds a MuJoCo scene where the xArm7 moves from home, presses a button, triggers an indicator lamp, and returns home, from one prompt.

Building the Button Press Task

For this demo, we start with an existing xArm7 MuJoCo setup and add a small control panel with a large button and an indicator lamp.

The xArm7 starts from its home position. The button is placed within the arm's workspace, with the lamp positioned beside it to provide a visible response when the button is pressed.

The task is intentionally simple:

home → button → lamp on → home

The goal isn't to build a complicated environment. It's to give the robot a complete interaction sequence where its movement causes a visible change in the simulation.

From Home to the Button

The xArm7 first moves away from its home position and approaches the panel.

As it gets closer, the end-effector needs to align with the button before making contact. Reaching the panel isn't enough. The arm has to approach the right location and press the button far enough to trigger the interaction.

This is similar to the controlled contact required in Peg Insertion in MuJoCo, where precise positioning determines whether the robot successfully completes the task.

Once the button is pressed, the indicator lamp turns on.

The lamp acts as a simple form of environmental feedback. Instead of having to inspect the robot's final position to determine whether the task worked, the simulation provides an immediate visual response.

Completing the Interaction

After triggering the lamp, the xArm7 retracts from the panel and returns to its original home position.

The complete sequence gives the robot three distinct stages:

Move → Interact → Respond

The final return to home is important because the task doesn't end at the moment of contact. The robot has to complete the interaction and recover to a known position.

This makes the demo more representative of a real robotic workflow than a simple point-to-point movement.

A Simple Starting Point for More Complex Tasks

A single button is only the beginning.

The same setup could be expanded into a larger control panel with multiple buttons and different responses. The xArm7 could be asked to press them in sequence, locate buttons at different positions, or react to different machine states.

The environment could also provide more complex feedback after each interaction, turning the panel into part of a longer manipulation task.

For this demo, however, the objective stays focused: press the button, trigger the response, and return home.

Like other MuJoCo robot simulations, the setup provides a controlled environment for testing these behaviors before introducing additional complexity.

FAQ

What is the xArm7 button press task?

It is a MuJoCo simulation where an xArm7 moves from its home position, presses a button, activates an indicator lamp, and returns home.

What does the indicator lamp do?

The lamp turns on when the button is successfully pressed, providing visible feedback from the environment.

Why use an existing xArm7 scene?

Starting with an existing robot model lets the demo focus on the new interaction instead of rebuilding the robot and simulation from scratch.

Can the button press task be extended?

Yes. Multiple buttons, sequential actions, different responses, and changing machine states could all be added to the same setup.

Related reading

Enjoyed this one? Send it to someone who’d find it useful.