T02 - T3WP Moving

T3WP Moving is a simple use case to create an AAS Digital Twin (DT) of a TurtleBot3 Waffle Pi (T3WP), then to monitor and control it. In detail, this Automated Mobile Robot can move forward and backward between two points A and B. When the T3WP DT receives a command from a user, it controls the T3WP to move forward or backward accordingly.

Requirements

The following components are required:

  • Network 192.168.56.0/24

  • TurtleBot3 Waffle Pi running ROS2

  • Computer A with pre-installed Papyrus4Manufacturing

  • Computer B with pre-installed ROS2

  • LocalSEA T02 Kit including some read-to-run software components

The following knowledge are required:

  • Basic about Networking

  • Basic about Java + Eclipse IDE

  • Basic about ROS 2

Deployment Instructions

In this example, computer A has the IP address 192.168.56.11, computer B has the IP address 192.168.56.8, and the T3WP has the IP address 192.168.56.3. After downloading the T02 Kit, decompress it to get the two packages: (1) t3wp_v0.1.tar.gz contains the ROS2 project to control T3WP from computer B, and (2) T02-T3wp.tar.gz contains the AAS model design to be built and run T3WP DT on computer A.

T3WP setup

Put T3WP on a flat surface and turn on the power switch.

On computer B, suppose that ROS2 is running, open a terminal and input the following commands:

$ export TURTLEBOT3_MODEL=waffle_pi
$ export ROS_DOMAIN_ID=30

Verify if the setup is correct by typing $ ros2 topic list | grep cmd_vel and the expected result will be shown as in Figure 1.

Figure 1. Result when checking a topic of T3WP

Extract t3wp_v0.1.tar.gz, copy it to the ROS2 workspace with the following commands:

$ tar -xzvf t3wp_v0.1.tar.gz
$ cp -r t3wp ~/Workspace/ament/src/

Build and run the T3WP controller with the following commands:

$ cd ~/Workspace/ament
$ colcon build --packages-select t3wp
$ ros2 run t3wp move

The expected result will be shown as in Figure 2.

Figure 2. Result when launch T3Wp controller

T3WP DT setup

On computer A, extract T02-T3wp.tar.gz with the following command:

$ tar -xzvf T02-T3wp.tar.gz

Open Papyrus4Manufacturing and import the project as in Figure 3. The AAS Design Diagram shows the basic elements of the project. Note that users can see property state and two operations goForward and goBackward inside submodel Basic.

Figure 3. Project T02-T3wp shown on Papyrus4Manufacturing

In Model Explorer, right click on the AssetAministrationShell T3WP, choose AAS, then click Generate Asset Administration Shell Basyx code (AAS). When a new project AAS_T3WP is generated, users open the file DynamicElementsWorkspace.java inside the package basic and modify functions get_Basic_state( ), Basic_goForward( ), and Basic_goBackward( ) as follows.

public Integer get_Basic_state() {	
  // Work with your Dynamic Property here. 
  Integer defaultVar = Integer.valueOf(connectedDevices.ep_http.readValue("/state").strip());
  return defaultVar;
}

public void Basic_goForward() {
  connectedDevices.ep_http.invokeMethod("/forward", null);
};

public void Basic_goBackward() {
  connectedDevices.ep_http.invokeMethod("/backward", null);
};

To run the AAS server including the T3WP AAS DT in Project Explorer, right click on AASServer.launch, choose Run As, then click AASServer.

Verification

If all the above setups are correct, then the T3WP AAS DT is connecting to the T3WP controller. The aim is to send command to T3WP AAS DT to control T3WP through the AAS API.

To get the state of T3WP, use the following command:

$ curl http://127.0.0.1:8080/aas/submodels/Basic/submodel/submodelElements/state/value

The commands for T3WP moving forward and backward require a content body. Create a file named Body and add the following content:

{
 "requestId": "{{$timestamp}}", 
 "inputArguments": [],
 "outputArguments": [],
 "timeout":5000
}

Run the following command to control T3WP moving forward:

$ curl -X POST -H 'Content-Type: application/json' -d @Body \
http://127.0.0.1:8080/aas/submodels/Basic/submodel/submodelElements/goForward/invoke

Run the following command to control T3WP moving backward:

$ curl -X POST -H 'Content-Type: application/json' -d @Body \
http://127.0.0.1:8080/aas/submodels/Basic/submodel/submodelElements/goBackward/invoke