Skip to content

Set Gravity

SUMMARY

Set Gravity configures the gravity vector used by the robot controller's dynamics model. The default vector corresponds to a standard upright mounting. Update this setting when the robot is mounted at a non-standard orientation, such as wall-mounted or inverted.

SUPPORTED ROBOTS

This skill is currently supported on Universal Robots only. Calling this method on other robot brands will raise a NotImplementedError.

The Skill

python
robot.set_gravity(direction=[0.0, 0.0, 9.82])

The Code

Example: Set Gravity for Upright Mounting

Set the gravity vector to the standard upright configuration.

python
from loguru import logger
from telekinesis.synapse.robots.manipulators import universal_robots

robot_ip = "192.168.1.2"  # replace with your robot's IP

robot = universal_robots.UniversalRobotsUR10E()
# Connect
robot.connect(ip=robot_ip)

gravity = [0.0, 0.0, 9.82]
robot.set_gravity(gravity)
logger.success(f"Gravity direction set to {gravity} m/s².")

# Disconnect
robot.disconnect()

The Explanation of the Code

set_gravity updates the gravity vector used in the controller's dynamics and torque computations, including gravity compensation in the joints. The direction is specified as a 3-element vector [gx, gy, gz] in base-frame coordinates [m/s²]. For a standard floor-mounted upright robot, the vector is [0.0, 0.0, 9.82]. For a ceiling-mounted (inverted) robot, use [0.0, 0.0, -9.82]. Returns True on success.

How to Tune the Parameters

ParameterTypeDefaultDescription
directionlist[float]3-element gravity vector [gx, gy, gz] in the robot base frame [m/s²].

Return Value

TypeDescription
boolTrue if the gravity direction was accepted by the controller, False otherwise.

Where to Use the Skill

  • Non-standard mounting — Configure gravity for wall, ceiling, or tilted robot bases
  • Mobile platforms — Update gravity when the robot is mounted on a platform whose orientation changes

When Not to Use the Skill

Do not use Set Gravity when:

  • The robot is floor-mounted in the standard upright orientation — the default gravity vector is already correct