Building the Low Level API Example
The following instructions assume a Linux system (or the Windows Subsystem for Linux).
-
Extract the source code from the archive linked at the top of the page
-
Open a terminal in the folder created from the archive (lowlevelapi)
-
Build the example by typing the command make in the terminal
-
Run the example by typing ./lowlevelapi_example (You may need to first set execute permissions by typing chmod +x lowlevelapi_example)
-
If the example is running properly, you should see the following in the terminal:
Sending commands to 127.0.0.1 on port 25500
Listening for data from 0.0.0.0 on port 25501
Running the Example in Simulation
- Run the simulator with both the lowlevelapi_example.toml and lowlevelapi_example_teststand.toml configuration files applied. Use the following command inside of the main folder
./ar-control-2021.02.11 'simulator.dynamic = true' ./lowlevelapi/examples/lowlevelapi_example.toml ./lowlevelapi/examples/lowlevelapi_example_teststand.toml
The simulator should display the following message in the terminal:
Agility Robotics Control Stack
Listening for low-level action data at port 25500
JSON message API server started, connect to http://localhost:8080/
-
Open a web browser and navigate to http://localhost:8080/gamepad
-
You should see the robot fixed upright in place with its limbs relaxed
-
Run the Low-level API example code as described in the previous section
-
The terminal running the simulator should display the message Publishing low-level observation data to 127.0.0.1:25501
-
Using the message-composer in another window, send an action-set-operation-mode to set the operation mode to low-level-api.
["action-set-operation-mode", {"mode": "low-level-api"}]
-
The robot in the visualization should move into the pose shown below
Running the Example in Hardware
- Connect ethernet cable to Digit and computer
- Apply the
lowlevelapi_example.toml
configuration file to Digit by going to http://10.10.1.1/configuration/ and uploading the file- Due to bug in the configuration browser, the file must be uploaded via ssh (see ssh page for more details)TODO: add ssh page link
- Robot must be rebooted to apply changes
- Modify the publisher_adress variable in lowlevelapi_example.c so it matches the following:
const char* publisher_address = "10.10.1.1";
- Rebuild the example program
- Turn on the robot
- When the robot has finished booting and you can view the visualization on the gamepad, release the e-STOP to
enable motor torques
- If you wish to use the simple terminal instead of gamepad go to: http://10.10.1.1:8080/examples/terminal.html
- Run the lowlevelapi_example code
- Set command priveleged by sending the following mesage in the mesage composer:
["request-privilege", {"privilege": "change-action-command"}]
in the simple terminal - Using the message-composer, send an action-set-operation-mode to set the operation mode to low-level-api.
["action-set-operation-mode", {"mode": "low-level-api"}]
- The robot should move into the same pose as in simulation