mirror of
https://github.com/nasa/trick.git
synced 2025-02-20 17:22:52 +00:00
Tutorial suggestions (#1274)
* Update Data-Record.md (#1265) Fix typo in input arg string. * Update TutVariableServer.md (#1269) tightened up grammar * Update TutVariableServer.md (#1270) more accurate usage hint * Update ATutNumericSim.md (#1271) instanciate -> instantiate line 376 * Update TutVariableServer.md (#1272) fixed ⚠️ (⚠️) not displaying properly * Update ATutNumericSim.md (#1273) fixed 👉 (👉) not displaying properly Co-authored-by: Brian <brianmhannan@gmail.com> Co-authored-by: Matthew D Elmer <matthewdavidelmer@gmail.com>
This commit is contained in:
parent
32339908fa
commit
b314c09eec
@ -36,7 +36,7 @@ Note: drg is just an example name. Any name may be used.
|
||||
|
||||
### Adding a Variable To Be Recorded
|
||||
|
||||
To add variables to the recording group call the <tt>drg.add_variable("<string_of_variable_name">)</tt> method of the recording group.
|
||||
To add variables to the recording group call the <tt>drg.add_variable("<string_of_variable_name>")</tt> method of the recording group.
|
||||
For example:
|
||||
|
||||
```python
|
||||
@ -44,7 +44,7 @@ drg.add_variable("ball.obj.state.output.position[0]")
|
||||
drg.add_variable("ball.obj.state.output.position[1]")
|
||||
```
|
||||
|
||||
An optional alias may also be specified in the method as <tt>drg.add_variable("<string_of_variable_name"> [, "<alias>"])</tt>.
|
||||
An optional alias may also be specified in the method as <tt>drg.add_variable("<string_of_variable_name>" [, "<alias>"])</tt>.
|
||||
If an alias is present as a second argument, the alias name will be used in the data recording file instead of the actual variable name.
|
||||
For example:
|
||||
|
||||
@ -121,18 +121,18 @@ recording groups as well as record a single point of data.
|
||||
|
||||
```c++
|
||||
/* C code */
|
||||
dr_enable_group("<group_name">) ;
|
||||
dr_disable_group("<group_name">) ;
|
||||
dr_record_now_group("<group_name">) ;
|
||||
dr_enable_group("<group_name>") ;
|
||||
dr_disable_group("<group_name>") ;
|
||||
dr_record_now_group("<group_name>") ;
|
||||
```
|
||||
|
||||
This is the Python input file version:
|
||||
|
||||
```python
|
||||
# Python code
|
||||
trick.dr_enable_group("<group_name">) ; # same as <group_name>.enable()
|
||||
trick.dr_disable_group("<group_name">) ; # same as <group_name>.disable()
|
||||
trick.dr_record_now_group("<group_name">) ;
|
||||
trick.dr_enable_group("<group_name>") ; # same as <group_name>.enable()
|
||||
trick.dr_disable_group("<group_name>") ; # same as <group_name>.disable()
|
||||
trick.dr_record_now_group("<group_name>") ;
|
||||
```
|
||||
|
||||
### Changing the thread Data Recording runs on.
|
||||
|
@ -264,7 +264,7 @@ int cannon_deriv(CANNON* C) {
|
||||
return(0);
|
||||
}
|
||||
```
|
||||
:point_right: **Add cannon\_deriv() to cannon\_numeric.c.**
|
||||
👉 **Add cannon\_deriv() to cannon\_numeric.c.**
|
||||
|
||||
<a id=creating-an-integration-class-job></a>
|
||||
#### Creating an Integration Class Job
|
||||
@ -320,7 +320,7 @@ int cannon_integ(CANNON* C) {
|
||||
|
||||
```
|
||||
|
||||
:point_right: **Add cannon\_integ() to cannon\_numeric.c.**
|
||||
👉 **Add cannon\_integ() to cannon\_numeric.c.**
|
||||
|
||||
<a id=updating-the-s_define-file></a>
|
||||
## Updating the S_define File
|
||||
@ -373,7 +373,7 @@ void create_connections() {
|
||||
|
||||
The first line here defines an integration scheduler called `dyn_integloop` that executes `derivative` and `integration` jobs in the *dyn* SimObject. The integration rate is specified in parentheses.
|
||||
|
||||
`create_connections` is a special function-like construct whose code is copied into S_source.cpp and is executed directly after SimObject instantiations. Common uses are to 1) instanciate integrators, and 2) connect data structures between SimObjects.
|
||||
`create_connections` is a special function-like construct whose code is copied into S_source.cpp and is executed directly after SimObject instantiations. Common uses are to 1) instantiate integrators, and 2) connect data structures between SimObjects.
|
||||
|
||||
`dyn_integloop.getIntegrator` configures our integration scheduler. Its first argument specifies the integration algorithm to be used. In the case `Runge_Kutta_4`. The second argument is the number of variables that are to be integrated. There are four variables for this simulation (pos[0], pos[1], vel[0], vel[1]).
|
||||
|
||||
|
@ -64,10 +64,9 @@ is to configure the sessions.
|
||||
|
||||
## Approach
|
||||
|
||||
Calling functions and setting simulation variables using the variable server is
|
||||
done as in the input file. That is, the client sends Python code to the variable
|
||||
server where it's executed, to call functions, set variables, or both. In the
|
||||
following sections we'll see examples of these. We'll also learn how to use the
|
||||
Calling functions and setting simulation variables with the variable server client is a similar process to doing the same with the input file. The client sends Python code to the variable
|
||||
server, where it's executed to call functions, set variables, or both. In the
|
||||
following sections, we'll see examples of these. We'll also learn how to use the
|
||||
variable server API to get data back to the client.
|
||||
|
||||
<a id=a-simple-variable-server-client></a>
|
||||
@ -89,7 +88,7 @@ import socket
|
||||
if ( len(sys.argv) == 2) :
|
||||
trick_varserver_port = int(sys.argv[1])
|
||||
else :
|
||||
print( "Usage: vsclient <port_number>")
|
||||
print( "Usage: python<version_number> CannonDisplay_Rev1.py <port_number>")
|
||||
sys.exit()
|
||||
|
||||
# 2.0 Connect to the variable server.
|
||||
@ -178,7 +177,7 @@ send messages using an ASCII encoding (rather than binary).
|
||||
The two [**var_add**](#api-var-add) commands add "dyn.cannon.pos[0]"
|
||||
and "dyn.cannon.pos[1]" to the session variable list.
|
||||
|
||||
:warning: Please notice that the quotes around the variable names must be
|
||||
⚠️ Please notice that the quotes around the variable names must be
|
||||
escaped with the '\' (backslash) character.
|
||||
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user