> For the complete documentation index, see [llms.txt](https://njord.gitbook.io/digital-competition-2023/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://njord.gitbook.io/digital-competition-2023/4-platform-interface/4.5-control-output.md).

# 4.5 Control Output

To control the vessel, guidance systems will be expected to continuously output a vector of 3 forces, in surge (forward/backward), sway (lateral) and yaw.

The example\_ros\_client node is published to the /force\_control topic and expects ‘GeneralizedForce’ messages. The message is built up of 3 forces, one for each translational degree of freedom, as well as 3 torques, for each rotational degree of freedom.

```
GeneralizedForce( 
x = force.x, 
y = force.y, 
z = force.z, 
k = force.k, 
m = force.m, 
n = force.n, 
) 
```

As the vessel is only actuated in 3 degrees of freedom (x, y and n), the remaining 3 forces (z, k and m) are ignored and should be set to 0.

The force controller accepts inputs between -100 and 100, where 100 results in full throttle. Larger inputs will be constrained back down to ±100.

The force controller can be tested by opening a terminal window in the virtual machine and tweaking the values in the following command:

```
source catkin_ws/devel/setup.bash

rostopic pub /force_control ros_clients/GeneralizedForce "{x: 0.0 , y: 0.0 , z: 0.0 , k: 0.0 , m: 0.0 , n: 0.0}"
```

This method will continuously apply the requested force until the command is canceled (ctrl+c) and run again with different values.
