h4r_x52_joyext
LED and MFD Control for Saitek X52 Pro
|
Printing values from std_msgs topics to the displays can be easily done with the x52_mfd_writer_node.
For each topic which you want to see information on the display you need a mfd_writer node.
All supported message types can be seen in the following table, in a launch file, they are specified by the parameter "input_type"
input_type | Description |
---|---|
0a | float64 |
1 | float32 |
2 | int64 |
3 | int32 |
4 | int16 |
5b | int8 |
6 | uint64 |
7 | uint32 |
8 | uint16 |
9b | uint8 |
10 | bool |
11c | Joy |
b)When using a one byte value (mainly known as char in C/C++), it is normally treated as character.
If the number value is wanted instead you have to set the value "char_as_int" to true.
c)Requires additional setup information, see following table:
Parameter | Description |
---|---|
axis_or_button | Defines if the value being used comes from an axis(false) or a button(true) |
axis_button | Defines the axis or button number |
To specify the arangement in the display the following parameters are used.
Parameter | Description |
---|---|
line | Defines the line, where the field should be placed |
pos | Defines the start of the field inside the line |
field_length | Defines the length of the field |
To specify what happens to the value alignment when the size of it is smaller the field length, the parameter align is used.
Align | Description |
---|---|
0a | Left - The field is filled with spaces from the right side, so that the value is on the left |
1 | Center - The field is filled with spaces from both sides |
2 | Right - The field is filled with spaces from the left side, so that the value is on the right |
If the integer part of any value exceeds the field size, the user should be notified somehow, that there is a problem. This is done by specifiying the oversize parameters:
Parameter | Description |
---|---|
positive_oversize | String shown when value is positiv and it's integer value does not fit into the field |
negative_oversize | String shown when value is negative and it's integer value does not fit into the field |
At least there is the option to print strings instead of values, this uses the same specification method as known from the value2buttonColor node.
Parameter | Description |
---|---|
strintprint | if true the stringprint_setup variable specifies the ranges in which a string is printed |
stringprint_setup | Specification when to write which string, see following paragraph |
The first given string is printed if the value is lower than any given value, the last one is printed when the value is higher than any given value.
In between the values are printed when the given value is exceeded.
Example:
Low|-4|One|3|Two|6|High
Example Results:
Value | Result |
---|---|
-6 | Low |
-4 | Low |
3 | One |
5 | Two |
7 | High |
Example Conditions:
String | Prints when |
---|---|
Low | Value <=-4 |
One | Value <=3 |
Two | Value <=6 |
High | Value >6 |
Copy&Paste Launchfile Code:
<node pkg="h4r_x52_joyext" type="x52_mfd_writer_node" name="x52_mfd_writer_string" output="screen"> <param name="input_type" value="11"/> <param name="line" value="1"/> <param name="pos" value="0"/> <param name="field_length" value="16"/> <param name="align" value="1"/> <param name="positive_oversize" value="++EE++"/> <param name="negative_oversize" value="--EE--"/> <param name="axis_or_button" value="false"/> <param name="axis_button" value="4"/> <param name="stringprint" value="true"/> <param name="stringprint_setup" value="Green|-0.5|Yellow|0.5|Red"/> <param name="char_as_int" value="0"/> <remap from="~/in" to="/joy" /> <remap from="~/mfd_text" to="/x52/mfd_text" /> </node>