# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://njord.gitbook.io/digital-competition-2023/4-platform-interface/4.5-control-output.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
