Lab 4 · The Drive Graph
What you do in this lab
In the last lab you drove the car and opened its graph. Now you read that graph, node by node: 27 nodes that turn four keys into six joint commands. Then you change it while the car drives.
Do this: read the cards. Then open the graph on the desktop, find each group of nodes, and do the three experiments.
Nodes, pins and two kinds of wire
An OmniGraph is a program that you can see. A node is one small function. A pin on its left side is an input, a pin on its right side is an output. A wire moves a value from an output to an input.
There are two kinds of wire, and they answer two different questions.
| data wire | WHAT: it moves a number, for example the speed. |
| execution wire | WHEN: it says "run now". It starts at a white arrow pin. |
Our graph has one execution chain: Tick to Odometry to
Ackermann to the two joint nodes. Tick fires one time per frame
while the simulation plays. A math node (subtract, multiply) has no execution pin: it
gives its value when a node downstream asks for it.
The graph is a prim (an item on the stage) at /World/DriveGraph, and each
node is a prim below it. So you find the nodes in the Stage panel too.
From keys to a speed and a turn
The left side of the graph has the same four steps two times: one time for the throttle, one time for the turn.
KeyForward KeyReverse KeyLeft
KeyRight | Read Keyboard State: is the key W, S, A or D down? True or false. |
Forward Reverse Left
Right | To Double: true becomes 1.0, false becomes 0.0. |
Throttle | Forward - Reverse: 1, 0 or -1. |
Turn | Left - Right: 1 is left, -1 is right. |
Speed | Throttle x MaxSpeed (3 m/s). |
SteeringAngle | Turn x the output of
SteerLimit. |
Hold W and S together: 1 - 1 = 0, and the car stops. A key gives only 1 or 0, so the graph asks for full speed or none. The Ackermann node makes that smooth (see below).
The steering limit
This row is one formula, one node per operation:
limit = TurnGrip / (speed x speed + Tiny) then held between Zero and MaxSteer
Odometry | Reads the velocity of the chassis from the physics. |
CarSpeed | The length of that velocity: the speed in m/s. |
SpeedSquared | speed x speed. |
Floor | Adds Tiny (0.01), so the next node
does not divide by zero when the car stands. |
GripAngle | TurnGrip (1.28) divided by that
sum. |
SteerLimit | Clamp: not below Zero, not above
MaxSteer (0.5 rad). |
TurnGrip is the wheelbase (0.32 m) x the sideways acceleration that the
steering may ask for (4 m/s^2). The tires hold about 8, so 4 leaves a margin.
| up to 1.6 m/s | 0.50 rad (full lock) |
| 3 m/s | 0.14 rad |
| 5 m/s | 0.05 rad |
The Ackermann node and the joints
Ackermann gets one speed and one steering angle for the car as a whole. It
gives one angle for each front wheel and one turn rate for each of the four wheels. It
knows the car from its inputs: wheelbase 0.32 m, track width 0.24 m, wheel radius
0.05 m.
| acceleration | 4 m/s^2: from 0 to 3 m/s in 0.75 s, not in one frame. |
| steeringAngleVelocity | 1.5 rad/s: the wheels need time to turn. |
| maxWheelRotation | 0.5 rad: no wheel turns more than full lock. |
The last two nodes are Articulation Controllers. They write the commands to the joints of the car.
SteerJoints | A position command (an angle) to the 2 steering joints. |
WheelJoints | A velocity command to the 4 wheel joints: 60 rad/s at 3 m/s. |
60 rad/s is the speed divided by the wheel radius: 3 / 0.05. The physics does the rest: the motors of the joints turn the wheels, and the tires push the car.
Change the graph while the car drives
The graph runs each frame, so a new value has an effect on the next frame. You do not stop the simulation.
Do this: three experiments.
- Set
MaxSpeedto 5. Drive a straight, then a corner. The car is faster and steers less: the limit at 5 m/s is 0.05 rad. - Set
TurnGripto 4. Take a corner at full speed. The car slides: the graph now asks for more grip than the tires have. - Set
TurnGripback to 1.28. SelectKeyForwardand set its Key from W to I, in the list. Now I is the throttle.
Nothing that you change is saved. Run ./lite.sh drive --graph again and the
graph is as before.
Follow the White Rabbit
The graph is made by one call in goatracer_lite/drive.py: a list of nodes,
a list of values and a list of wires. Read it on the desktop, next to the editor:
less goatracer_lite/drive.py. Each name in the editor is a name in that
file.
- OmniGraph - the node language of Isaac Sim.
- Ackermann steering geometry - why the two front wheels turn by different angles.
Play
- Open the Desktop Press Start a desktop and wait for the screen. It opens in a new tab; keep this one for the steps.
- In the terminal named GoatRacerLite, type:
./lite.sh drive --graph
The car shows, and the graph opens below it with a name on each node. - Find the four groups: the keys on the left,
SpeedandSteeringAnglein the middle,Ackermannand the joints on the right. Move the view down with the middle mouse button: the steering limit is the row below. The mouse wheel is the zoom. - Click one time in the picture of the car and drive with W S A D. The graph runs while you drive.
- Click the node
MaxSpeed. The Property panel, on the right, shows its Value. Type 5 and press Enter. Click in the picture of the car again, and drive. - Do the same with
TurnGrip(4, then 1.28 again), and with the Key ofKeyForward. - Press Stop on the Desktop page when you are done. The minutes stop there.
// No names on the nodes? Turn the mouse wheel to zoom in. No keys? Click in the picture of the car again.
Code
// The nodes of the graph, from goatracer_lite/drive.py. Each pair is a name and a node type. The name is what the editor shows.
("Tick", "omni.graph.action.OnPlaybackTick"),
("KeyForward", read_key), ("KeyReverse", read_key), ("KeyLeft", read_key), ("KeyRight", read_key),
("Forward", "omni.graph.nodes.ToDouble"), ("Reverse", "omni.graph.nodes.ToDouble"),
("Left", "omni.graph.nodes.ToDouble"), ("Right", "omni.graph.nodes.ToDouble"),
("Throttle", "omni.graph.nodes.Subtract"), ("Turn", "omni.graph.nodes.Subtract"),
("MaxSpeed", "omni.graph.nodes.ConstantDouble"), ("MaxSteer", "omni.graph.nodes.ConstantDouble"),
("Speed", "omni.graph.nodes.Multiply"), ("SteeringAngle", "omni.graph.nodes.Multiply"),
("Odometry", "isaacsim.core.nodes.IsaacComputeOdometry"), ("CarSpeed", "omni.graph.nodes.Magnitude"),
("SpeedSquared", "omni.graph.nodes.Multiply"), ("Floor", "omni.graph.nodes.Add"),
("Tiny", "omni.graph.nodes.ConstantDouble"), ("TurnGrip", "omni.graph.nodes.ConstantDouble"),
("GripAngle", "omni.graph.nodes.Divide"), ("Zero", "omni.graph.nodes.ConstantDouble"),
("SteerLimit", "omni.graph.nodes.Clamp"),
("Ackermann", "isaacsim.robot.wheeled_robots.AckermannController"),
("SteerJoints", "isaacsim.core.nodes.IsaacArticulationController"),
("WheelJoints", "isaacsim.core.nodes.IsaacArticulationController"),
// Some of the values. The file sets them one time, when it makes the graph.
("KeyForward.inputs:key", "W"), ("KeyReverse.inputs:key", "S"),
("KeyLeft.inputs:key", "A"), ("KeyRight.inputs:key", "D"),
("MaxSpeed.inputs:value", float(speed)), ("MaxSteer.inputs:value", STEER_MAX),
("Tiny.inputs:value", 0.01), ("Zero.inputs:value", 0.0),
("TurnGrip.inputs:value", WHEELBASE * TURN_ACCEL), # angle limit = wheelbase * a / v^2
("Ackermann.inputs:acceleration", 4.0), # m/s^2: the launch ramp
Do this: count the node types. The graph has 27 nodes and 13 types. Which type has the most nodes?
Check yourself
Only a check: nothing depends on it. Take it any time.
- A node is one function. A data wire moves a value. An execution wire says when a node runs.
- The drive graph has one execution chain: Tick, Odometry, Ackermann, the joint nodes. It runs each frame.
- The steering limit is one formula in nodes: TurnGrip / (speed squared), between 0 and MaxSteer.
- The Ackermann node knows the car from its inputs. It gives two wheel angles and four wheel speeds.
- You can change a value while the car drives. The change has an effect on the next frame, and is not saved.
- RoboRacer course: Lecture 4 - Laplace Domain Dynamics and PID - the control loop behind the motor and the steering servo
- RoboRacer course: Lecture 6 - Vehicle States and Vehicle Dynamics - the bicycle model: what the simulator's plant is built on
// roboracer.ai (formerly F1TENTH), not goatracer.ai. Each link opens in a new tab.