Base Remote Control Service

The Base Remote Control service implements an input controller as a remote control for a base. This uses the input api to make it easy to add remote drive controls for your rover or other mobile robot with a controller like a gamepad.

Add the Base Remote Control service after configuring your robot with a base and input controller to control the linear and angular velocity of the base with the controller’s button or joystick controls.

Control mode is determined by the configuration attribute "mode", for which there are five options:

  1. "arrowControl": Arrow buttons control speed and angle
  2. "triggerSpeedControl": Trigger button controls speed and joystick controls angle
  3. "buttonControl": Four buttons (usually X, Y, A, B) control speed and angle
  4. "joyStickControl": One joystick controls speed and angle
  5. "droneControl": Two joysticks control speed and angle

You can monitor the input from these controls in the Control tab of the Viam app.

Configuration

You must configure a base with a movement sensor as part of your robot to be able to use a Base Remote Control service.

Navigate to the Config tab of your robot’s page in the Viam app. Click the Services subtab, then click Create service in the lower-left corner. Select the type Base Remote Control. Enter a name for your service, then click Create.

An example configuration for a base remote control service in the Viam app Config Builder.

{
  "name": "<your-base-remote-control-service>",
  "type": "base_remote_control",
  "attributes": {
    "base": "<your-base-name>",
    "input_controller": "<your-controller-name>"
  }
}
{
  "name": "my-base-remote-control-service",
  "type": "base_remote_control",
  "attributes": {
    "base": "my-base",
    "input_controller": "my-input-controller",
    "control_mode": "arrowControl"
  }
}

Edit and fill in the attributes as applicable. The following attributes are available for base remote control services:

NameTypeInclusionDescription
basestringRequiredThe name of the base you have configured for the base you are operating with this service.
input_controllerstringRequiredThe name of the input controller you have configured for the base you are operating with this service.
control_modestringOptionalThe mode of remote control you want to use.
Options:
  • "arrowControl"
  • "triggerSpeedControl"
  • "buttonControl"
  • "joyStickControl"
  • "droneControl"

Default: "arrowControl"
max_angular_degs_per_secfloatOptionalThe max angular velocity for the base in degrees per second.
max_linear_mm_per_secfloatOptionalThe max linear velocity for the base in meters per second.

API

The base remote control service supports the following methods:

Method NameDescription
CloseClose out of all remote control related systems.
ControllerInputsGet a list of inputs from the controller that is being monitored for that control mode.

Close

Close out of all remote control related systems.

Parameters:

  • ctx (Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.

Returns:

  • (error): An error, if one occurred.

For more information, see the Go SDK Docs.

baseRCService, err := baseremotecontrol.FromRobot(robot, "my_base_rc_service")

// Close out of all remote control related systems.
err := baseRCService.Close(context.Background())

ControllerInputs

Get a list of inputs from the controller that are being monitored for that control mode.

Parameters:

  • None

Returns:

  • ([]Control): A list of inputs from the controller that are being monitored for that control mode..

For more information, see the Go SDK Docs.

baseRCService, err := baseremotecontrol.FromRobot(robot, "my_base_rc_service")

// Get the list of inputs from the controller that are being monitored for that control mode.
inputs := baseRCService.ControllerInputs()


Have questions, or want to meet other people working on robots? Join our Community Discord.