Skip to content

Commit 07fe5f9

Browse files
Copilotmsis
andcommitted
Remove manual app/comms freq setting - handled automatically by AppTick/CommsTick
Co-authored-by: msis <577139+msis@users.noreply.github.com>
1 parent 8e0c3b9 commit 07fe5f9

3 files changed

Lines changed: 18 additions & 28 deletions

File tree

Documentation/examples/simpleapp.moos

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ ProcessConfig = MOOSDB
1515

1616
ProcessConfig = pymoos_simple_app
1717
{
18-
AppTick = 1.0
19-
CommsTick = 5.0
18+
AppTick = 2.0
19+
CommsTick = 10.0
2020

2121
// Custom configuration parameters
22-
app_freq = 2.0
23-
comms_freq = 10.0
2422
variable_name = simple_app_var
2523
max_iterations = 10
2624
}

Documentation/examples/simpleapp.py

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,20 @@
1313
def on_startup():
1414
print("App starting up...")
1515

16-
# Read configuration from the mission file
17-
# The mission file should have a ProcessConfig block for this app
18-
success, freq = app.get_configuration_double('app_freq')
19-
if success:
20-
print(f"Setting app frequency from config: {freq} Hz")
21-
app.set_app_freq(freq)
22-
else:
23-
print("Using default app frequency: 1.0 Hz")
24-
app.set_app_freq(1.0)
16+
# Note: AppTick and CommsTick from the mission file are automatically
17+
# handled by CMOOSApp - you don't need to read or set them manually.
2518

26-
success, comms_freq = app.get_configuration_double('comms_freq')
19+
# Read custom configuration parameters from the mission file
20+
# The mission file should have a ProcessConfig block for this app
21+
success, var_name = app.get_configuration_string('variable_name')
2722
if success:
28-
print(f"Setting comms frequency from config: {comms_freq} Hz")
29-
app.set_comms_freq(comms_freq)
23+
print(f"Will publish to variable: {var_name}")
3024
else:
31-
print("Using default comms frequency: 5.0 Hz")
32-
app.set_comms_freq(5.0)
25+
print("Using default variable name: simple_app_var")
3326

34-
# Read other configuration parameters
35-
success, var_name = app.get_configuration_string('variable_name')
27+
success, max_iter = app.get_configuration_int('max_iterations')
3628
if success:
37-
print(f"Will publish to variable: {var_name}")
29+
print(f"Will run for {max_iter} iterations")
3830

3931
return True
4032

@@ -50,7 +42,7 @@ def on_new_mail(mail):
5042
msg.trace()
5143
return True
5244

53-
# Iterate is the main work loop, called at the frequency set by set_app_freq
45+
# Iterate is the main work loop, called at the frequency set by AppTick in the mission file
5446
iteration_count = 0
5547
def iterate():
5648
global iteration_count

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,11 @@ import pymoos
5555
app = pymoos.app()
5656

5757
def on_startup():
58-
# Read configuration from mission file
59-
success, freq = app.get_configuration_double('app_freq')
58+
# AppTick and CommsTick are automatically read from mission file
59+
# Read custom configuration parameters
60+
success, my_param = app.get_configuration_string('my_param')
6061
if success:
61-
app.set_app_freq(freq)
62-
else:
63-
app.set_app_freq(10.0) # Default Hz
62+
print(f"Configuration parameter: {my_param}")
6463
return True
6564

6665
def on_connect_to_server():
@@ -78,7 +77,8 @@ app.set_iterate_callback(iterate)
7877
app.run('localhost', 9000, 'my_app', 'my_mission.moos')
7978
```
8079

81-
The `app` class supports reading configuration from MOOS mission files using:
80+
The `app` class automatically handles `AppTick` and `CommsTick` from the mission file.
81+
For custom configuration parameters, use:
8282
- `get_configuration_string(param)` - Read string parameters
8383
- `get_configuration_double(param)` - Read numeric parameters
8484
- `get_configuration_int(param)` - Read integer parameters

0 commit comments

Comments
 (0)