Skip to content

Computer Payload

Nitzan Orr edited this page Apr 29, 2024 · 21 revisions

Raspberry Pi 4

We’re currently using the RPi4 (AKA "raspi 4") as the computer mounted on top of Spot. We tried to use the Nvidia Jetson Nano computer, but it did not work due to lack of support for the latest Jetpack OS, which is required for Spot’s ROS 2 package. However, we’re no longer trying to use Spot’s ROS 2 package. The raspi is running Ubuntu 22.04, and there are plans to switch to RPi 5 in 2024.

Note that we're using the term "Computer Payload" while avoiding the term "on-board computer" to avoid confusion with the internal computer of Spot.

The benefit of programming Spot via the Computer Payload is that you can SSH into it while keeping your own computer connected to the internet. This convenience is made possible by the Computer Payload having been configured to connect to both Spot (specifically, the Spot's GXP), and the campus WiFi. Details about SSH and network configuration can be found below. Additionally, programming Spot from the Computer Payload is beneficial because it's wired to the spot, which ensures a reliable connection (versus WiFi), and potentially offers lower latency when it comes to transferring real-time data.

Storage

Since the RPi's storage is limited by the SD card size, we've added a USB Drive to serve as additional storage space. To easily access the USB Drive, create symbolic links ("symlinks") in the home directory. For example, ~/Data/ is a symlink to the USB Drive's Data directory. Of course, feel free to use other workflows if preferred.

The symlink for Data was created using: ln -s /media/pi/SamsungUSB/Data/ ~/Data

Now, because accessing the USB Drive requires that it be 'mounted', there's a script in /etc/fstab to mount it during startup. The added script is: UUID=64A5-F009 /media/pi/SamsungUSB auto rw,user,nosuid,nodev,nofail,umask=1000 0 0. Before the script was added, the USB Drive would only be mounted if you logged into the raspi in-person, but not if you only SSHed to it. With the script, the drive is mounted during startup which means that when you SSH to it, the USB Drive is already mounted and accessible. The script was supposed to also enable read/write access the drive, but that didn't work so chmod command was also used to enable read/write access on the USB Drive.

If you have a Mac and want to remotely access the data on the raspi, see the "Remote Storage" below.

SSH, Development, and Remote Desktop

SSH

The IP address of the RPi may change at any moment, but generally keeping it turned ON maintains the same IP address:

ssh pi@<IP_ADDRESS> Ask lab mates for password.

Development on Raspberry Pi

Safety Configurations

To ensure good security practices, do not upload code to Github that includes the robot's password. Instead, have your code read an environment variable that contains the password string -- see here for python instructions. The RPi4 has the spot's password set in the env variable: BOSDYN_CLIENT_PASSWORD This env var can be set through ~/.bashrc (which has already been done on the RPi4). See here for more details

When using the Spot's Python API, you can use the above instructions with the following code to authenticate the robot automatically: robot.authenticate(username=<USER>, password=<PASSWORD>) then bosdyn.client.util.authenticate(robot). This avoids the terminal asking you for login credentials every time.

Remote Development

For development purposes, you can use VS Code on your local machine to develop directly on the RPi via a network tunnel connection. Instructions on how to connect your VS Code environment to the RPi can be found here

Remote Storage

These instructions are for MacOS, but there should be alternatives for other OS's as well. To download the files on the raspi to your own Mac computer, you can use the plain old scp as follows: scp pi@<ip_address>:<path_to_file_on_raspi> <local_destination> However, a more user-friendly method of accessing files on pi remotely is to connect Finder (on Mac) to the raspi directly. See here for instructions. These instructions work for accessing the raspi's filesystem, but to access the USB Drive connected to the raspi, you might need to edit the mentioned afp.conf file to be:

[pi_USBDrive]
path = /media/pi/SamsungUSB
valid users = pi

Note: pi_USBDrive is just a name. It can be anything.

Note: when connecting to the afp server through Finder, make sure the username is pi.

Remote Desktop

The RPi can theoretically be accessed with a remote desktop client, but instructions are still TBD.

Network

The RPi or Jetson Nano computer can be connected to both WiFi for internet access, and the Spot simultaneously. The connection to Spot can be done either via the RJ45 port on the spot’s body or to the RJ45 port on the GXP, however each connection requires different network configurations on the RPi/Jetson – see the config instructions below. We're choosing to connect to the GXP because the RPi4 is a payload, and payloads are meant to be connected to the GXP. If using the Jetson Nano, the Jetson’s performance configuration should be set to Max as that seems to offer a more stable network connection.

Network Configuration Instructions

Wired Connection to Spot’s Body

To connect RPi or Jetson to Spot’s body:

  • Connect Ethernet cable to the spot’s body, not GXP.
  • From the Network Settings of RPi, select “Wired connection”
  • IPv4 Settings → Routes → Use this connection only for resources on its network
  • IPv4 Settings → Method: Manual → Set Address=10.0.0.6 (or similar), Set Netmask=24 (or 255.255.255.0 which is the same, but in a different format). Leave gateway blank
  • For more info, see: Spot Network Setup
  • Test connection by pinging robot: ping 10.0.0.3
  • If failed, restart of RPi/Jetson might be required for changes to take effect

Wired Connection to GXP

To connect RPi or Jetson to GXP:

  • Connect Ethernet cable to the GXP (black onboard module with RJ45 and HD15 ports)
  • From the Network Settings of RPi, select “Wired connection”
  • IPv4 Settings → Routes → Use this connection only for resources on its network
  • IPv4 Settings → Method: Manual → Set Address=192.168.50.5 if GXP is attached to the front payload port. Or Set Address=192.168.50.6 if GXP is connected to the rear payload port, Set Netmask=24 (or 255.255.255.0 which is the same, but in a different format). Leave gateway blank (even though the GXP Payload Reference (below) says otherwise)
  • For more info, see Page 6 of GXP Payload Reference
  • Test connection by pinging robot: ping 192.168.50.3
  • If failed, restart of RPi/Jetson might be required for changes to take effect

Power

Wiring Safety

WARNING Please make sure the wires used have an appropriate guage size (smaller guage number == bigger diameter) appropriate DC current (AMPS) and DC voltage rating. When in doubt, oversize wire as bigger diameter -> higher current limit WARNING

wire color code

RED = DEAD (if you touch) = Live wire = Hot wire = 5, 12, or 24v
BLACK = GROUND = 0v

Power = voltage * current.

Make sure to double-check the maximum gauge the breakout board can support (i think max around 16-18 gauge. double check that plz). If gauge too large (number too small), it won't fit in the breakout board

WARNING Plz always double check the wiring with a multimeter and work with the robot turned off and battery unplugged. Remove device from GXP and spot before modifying the wiring. Anything more than .009 amps will send you straight to Jesus as your muscles can't let go (according to OSHA). The spot outputs 2A - 12.5A WARNING

Raspberry Pi 4 Power Requirements:

The Pi runs off of 5V⎓3A (15W) via USC-C or direct 15v and wires.

Documentation for pi power requirements https://github.com/raspberrypi/documentation/blob/develop/documentation/asciidoc/computers/raspberry-pi/power-supplies.adoc

Power Provided by Spot's GXP

Spot GXP Module Power Output: https://support.bostondynamics.com/s/article/Spot-General-Expansion-Payload-GXP contains pinout for the HD15 port

There is an HD15 port (same shape as VGA) on the back of the GXP that can provide regulated power at 5V, 12V, and 24V, to power payloads we attach to Spot. The power is regulated at the voltage level. That means it will stay at that voltage level regardless of the power draw. (until you exceed the power rating). Because the voltage is locked, the current varies to the power requirement of the connected device.

However, how do we plug in the wires into the GXP port and have the wires stay there? Furthermore, a bunch of wires loosely attached to the port looks bad and is a hazard. To access the power, a male HD15 port breakout board is required. Check documentation for the pinout. The benefit of these boards is that they provide clean and securing wiring to the GXP's HD15 port. The breakout board is convenient because it is labeled with port numbers and adding or removing wires only requires a screwdriver (no soldering).

Output Maximum: 5V⎓2A (10W) 12V⎓12.5A or 24⎓6.25A, or some combination up to 150W shared between 12V and 24V

Current configuration to power the RPi (or any USB power device):

To power the RPi and other USB devices from the GXP, there are two initial problems to solve. These devices usually require 5 volts 3 amps for 15 watts. However, the GXP's 5-volt output only supports 10 watts, thus leaving devices underpowered. The rationale is to use a buck converter to step down the voltage of the GXP's 12v or 24v output. Another issue is that you can't plug live and ground wires into a USB port due to obvious issues. Thus we must buy a device to convert bare wire power into USB power.

Due to available solutions on the market, we went with the convenient route of buying a buck converter that also outputs the power in a USB A format, (which may have USB handshaking capabilities which idk is required for 15 watts). Aka a two-in-one solution. It is trivial to buy either a cable or an adaptor to convert from USB A to USB C or other USB connection formats (micro, B, etc..) To connect USB devices, use a DC buck converter to USB rated for 12v - 24v input that steps down to 5v output. If the buck converter supports quick charge, that's fine. You will need to solder ground and hot wire to the device for a secure and safe connection.

Additionally, we sometimes want to keep the RPi running while the robot is off, so we added an on-board external battery. This bank can be constantly charged by the robot itself through a USB cable from the buck converter. However, The Anker battery we are using tends to reboot when we change from charging to uncharging and vice versa, so if the RPi is connected, it loses power temporarily and reboots.

The battery specs are ___.

TODO: add picture of wiring setup

Parts: db15 breakout board power step down usb A output

Converting from Spot's GXP to a Barrel Plug

Some devices do not support USB power and require a barrel plug connection. For these devices, there are 2 possible routes to power these devices directly from GXP. Find a barrel plug you are willing to sacrifice that has the right shape. Another option is barrel plugs Amazon (don't be lazy and remember to double-check the wire gauge)

To determine the wiring of the new barrel plug, you must look at the OEM barrel plug that comes with the device to determine polarity. Barrel connectors don't have a defined polarity. Instead, what you'll have is the polarity set by the device that you want to use, if the device is using DC in the first place. Near the receptacle for the barrel connector you might see a sign with something like this:

Take note of the signs marked on your device where the + and - symbols are drawn.On the example above, the + sign is connected to the outer shell in this example, meaning that the outside of the connector is positive and the - sign is connected to the black dot in the middle, meaning that the inside connection is negative.If the symbols are the other way around, the opposite is true. If the line touching the tip in the center has a + (plus) symbol, this means the tip is positive, and the outer shell is negative.

In any case, you need to research this for your particular device. There is no general rule. source

Use a multimeter on your sacrificial barrel plug to determine which wire corresponds to the outer shell and which wire corresponds to the inner connection. Double and Triple check the polarity of OEM and sacrificial barrel plug or meet God. Once everything is considered, take the hot and ground wire and directly attach it to the GXP's breakout board. Take the barrel plug and attach to the device.