Creating ClearView Models
Introduction
This document describes how to create new models for ClearView.
Model file structure
All models are stored in the models folder. Each model is fully contained in its own folder named after the model.
Example1:
If ClearView is installed in c:\Program Files, all models are in c:\Program Files\SVKSystems\clearview\models. The A-10 model is in c:\Program Files\SVKSystems\clearview\models\A-10, and Raptor60 is in c:\Program Files\SVKSystems\clearview\models\Raptor60
This is the model folder structure:
<model-folder-name>
params.txt
params.txt.bkp
--- some other supporting files that will be described in other sections ---
<data>
<wavdata>
The data folder contains 3d files and texture images and the wavdata folder contains the sound files used by the model.
If a new model folder is added to the models folder, ClearView must be restarted so the model is seen in the ClearView load model menus. In generall, if you add new files, ClearView must be restarted before the new files are seen. If you modify existing model files, the model must be reloaded for the changes to take place.
Model parameter files
All model activities can be separated in 3 major functional areas:
- Flight simulation
- World interaction
- World and model rendering (visualization)
ClearView needs structured information that defines model parameters for each one of these areas.
Files by functional area:
Flight Simulation:
1. params.txt - text file that provides attributes to all model objects
2. data\fmodel.ac - 3d file in ac3d format that defines the model physics objects.
World Interaction:
1. params.txt - defines breakable parts, model mass and some other related parameters.
3. data\colbody.ac - 3d file in ac3d format that defines the model geometry. That geometry is used for collision detection
World and model rendering:
1. params.txt - some parameters there control some rendering aspects (example - renderPart parameter defines environmental reflection for parts)
2. data\model.ac - 3d file in ac3d format that defines the model geometry that will be rendered on screen
As we can see, there is one text file - params.txt and 3 3d files - fmodel.ac, colbody.ac and model.ac that define a model.
fmodel.ac defines physics geometry, colbody.ac defines colision geometry and body.ac defines rendered (visualized) model geometry.
Physics geometry
File fmodel.ac is used to define the physics geometry. Each model in ClearView is constructed by using combinations of two primary objects:
- Thrust objects
- Lift objects
These objects are represented in fmodel.ac. Each primary object is represented by two ac3d objects. The first one is XYZObject and the second one is an ac3d surface with specific size and orientation. A special naming convention is used to link these two ac3d objects together as shown:
Primary Object name: LeftWing
AC3D objects names: LeftWing.XYZObject and LeftWing.lwingsurface
Thrust objects represent variety of propulsion systems. Currently, there are 3 types of thrust objects.
Thrust Objects:
- Propellers (props)
- Tail Propellers (tail props)
- Main rotor propellers (main props)
Each object inherits all properties and capabilities of the previous, simpler type propeller. The props class represent any device that produces thrust by rotating blades. The tail prop extend that capability by introducing blade pitch change and the main prop extends the tail props capabilities by adding cyclic control and fly bar stabilization.
Lift Objects:
The lift surface object defines a single rectangular wing. The geometry object defines the wing size and the assosiated XYZObject defines the wing location. The drag ballobject represents a drag object. Drag force will be applied at the position of this object
Name convention in fmodel.ac:
Propeller Objects:
PropellerNNN
PropellerNNN.XYZObject
Tail Rotor Objects:
TailRotorNNN
TailRotorNNN.XYXObject
Main Rotor Objects:
MainRotorNNN
MainRotorNNN.XYZObject
Sphere (Drag) objects:
SphereNNN
SphereNNN.XYZObject
Lift Surface Objects:
SurfaceNameNNN
SurfaceNameNNN.XYZObject
Plane Example:
- Model plane will have the plane wings defined as one or more lift surface objects, the plane body defined with one or more lift surface objects, the same for the elevator and the rudder. The control surfaces must also be defined by its own lift surface objects. Finally, there must be a single propeller object positioned where the model propeller is.
Heli Example:
- Model heli will have one main prop object, one tail prop object, drag ball representing the body center of drag, and may be two lift surfaces representing the model tail surfaces.
Colision geometry
For performance reasons, the model colision data is kept separate from the model shape data (the renderable 3d model). The renderable model may contain 3000-10000 surfaces and can't be used directly for collision detection. The model meshes are in body.ac The model consist of named parts. The model colision data is in colbody.ac where each important part from body.ac have simplified part with same name and location but in colbody.ac
The model wheels must be triangles with one vertice pointed downwards. They must be named using the following convewntion:
Nosewheel name: nosegear
Tail Wheel name: tailgear
Main wheels - maingear1 and maingear2
The propdisk colision object must must be named "propdisk". The prop disk is important, because when the program detects any colision between the prop disk object and another object, the model will crash.
Render geometry
The model render date is provided in file named body.ac All surfaces must be defined with 3 or for vertices. Surfaces with more than 4 vertices will not be rendered. The model is represented using 3d parts. Each model part must have unique name. Special conventions are used to represent moving parts, crashable parts and the moving propellers. Helicopter main rotors are crashable and they use another, more complicated set of rules. To make a moving part, a XYZObject is assosiated with the part by using this naming conveintion:
Original Part name: LeftAileron
Action1: Import XYZObject from Data folder. Orient the object so the X axis of the object is alligned with the aileron rotational axis.
Action2: Name XYZObject to LAeleron.XYZObject
Action3: Name LeftAileron to LAeleron.LeftAileron
As result we have a group of two objects:
LAeleron.XYDObject
LAeleron.LeftAileron
This grouping is logical and the qualifier name LAeleron is called "Group Name". This logical grouping allows to define group of objects by naming them with the same "Group Name". When ClearView reads a group that contains XYZObject, ClearView uses this XYZObject to define the 3 rotational axis for that group. ClearView can then rotate all objects in this group by any axis by using the model servos. Model groups can me hierarchical:
Example:
LWing.LeftWing
LWing.XYZObject
LWing.LAeleron.XYDObject
LWing.LAeleron.LeftAileron
- this defines two nested groups. ClearView can use servos to move LeftWing and LeftAeleron together along axes defined by LWing.XYZObject. ClearView can also move LeftAileron relative to axes defined by LWing.LAeleron.XYDObject
The best way to figure how to make a new model is to study the existing models and how are they made. Start with a model that is closes to your model and then try to evolve your model by replacing parts in the original model.
Model Parameters File
params.txt contains parameters that define the model flight characteristics, rendering oprions and crashable parts. The parameter verNumber n devines what is the params.txt version. There are 4 old helicopter versions and 5 plane versions. All older model versions are supproted. All they have different parameters. This document is focused on explaining tha parameters and options for version 6. Vesrion 6 is the new unified flight physics for planes and helicopter. This new flight physics is so flexible that practically for any real flying model, you can build a model in the simulator that will perform in similar way. The params.txt for version 6 has parameter verNumber 6.
The parameter file for version 6 consists of multiple sections. Each section starts with #begin <sectionname> and ends with #end <sectionname>. The main sections is named params and contain parameters that are common for the whole model. Just like your real RC model is build from parts (wings, motors, propellers, servos, etc) the ClearView modesl are build from objects. The ClearView model objects represent the real model objects. Each object in the model has a corresponding section in the params file. If the object name is servo1 for example, the corresponding section is:
#begin servo.throtServo
... parameters describing servo1 object...
#end servo.throtServo
As we see in the example, the section is named using using two names separated by dot. The first name is "type" name. Each model object is of different "type" - examples of types are servo, receiver, liftsurface, motor, propeller etc. The type reffers to class of things. The second name is the name of particular instance of this class of things. In the example, tha class (or type) is servo and the particular servo instance (or particular servo obect) is throtServo.
The following section are created for each physics object in fmodel.ac file:
-
liftsurface
-
dragsphere
-
propeller
-
tailrotor
-
mainrotor
The following sections are created for each model object listed in params section:
-
motor
-
receiver
-
transmiter
-
servo
-
speedcontrol
-
mixer
-
governor
-
gyro
For example, if we have two engine plane in params section we could have the command:
modelMotors leftMotor rightMotor
Upon loading the params section, ClearView will create two new objects for that model that represent these two engines. Two sections for these two objects will be created. The default parameters for these engines will be populated.
#begin motor.leftMotor
breakPartName none
debug 0.0
driveshaft1GearRatio 1
driveshaft1OneWayBB 1.0 // 1 for one way ball bearing
driveshaft2GearRatio 1.0
driveshaft2OneWayBB 0.0 // 1 for one way ball bearing
driveshaft3GearRatio 1.0
driveshaft3OneWayBB 0.0 // 1 for one way ball bearing
driveshaft4GearRatio 1.0
driveshaft4OneWayBB 0.0 // 1 for one way ball bearing
engineBrakingCoef 1.0
inputThrotChanel 0
inputThrotName none
inputThrotType none
maxRPM 40000.0
motorRotatingMass 2.0
motorRotatingMassDiam 2.0
powerCurveWatts 0.0 500.0 500.0 500.0 500.0
#end motor.leftMotor
Similar section for the rightMotor will also be created. Once we load the params file for first time, we can see all sections created. After that we can start wiring the components together and making proper parameter adjustments. In summary, ClearView model is made form separate parts - we call them objects. Each object is represented with it's own section in the params file. The section is named using the object class and the object name. We car wite objects accordingly, the same way we would do that in a real model - for example, we can plug the ClearView m,odel servos to the receiver, the gyro to the recxeiver, a servo to a gyro and the servo to the tail propeller or to a flight surface. That way, there is direct correspondance between our real model components and ClearView model components. Any model, with any number of componennts, wired in any way could be simulated. This is as far as we know the most flexible model creation system in modern rc simulators.
Params file description
Main section
#begin params
apilotAelCoef 2.0
apilotAelGain 0.0
apilotElevCoef 2.0
apilotElevGain 0.0
apilotOn 0.0
apilotRudCoef 5.0
apilotRudGain 0.0
apilotType 0.0
breakPart horizfin 1.0 10.0 1.0 5.0 50.0 1.0 0.0 0.0 0.0
breakPart lSkidB 1.0 15.0 1.0 8.0 330.0 1.0 0.0 0.0 0.0
breakPart lSkidF 1.0 15.0 1.0 8.0 330.0 1.0 0.0 0.0 0.0
breakPart movabledisk 20.0 0.0 0.0 0.0 10.0 1.0 0.0 0.0 0.0
breakPart propdisk 10.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0
breakPart rSkidB 1.0 15.0 1.0 8.0 330.0 1.0 0.0 0.0 0.0
breakPart rSkidF 1.0 15.0 1.0 8.0 330.0 1.0 0.0 0.0 0.0
breakPart taildisk 10.0 0.0 0.0 0.0 1.0 12.0 0.0 0.0 0.0
breakPart tailfin 1.0 10.0 1.0 5.0 50.0 1.0 0.0 0.0 0.0
centerOfGravity 0.0 0.0 0.0
dimensions 0.3 0.3 0.3
floatsHeight 0.12
floatsOffset -0.1
floatsVolumeUnits 4.0
gravity 9.8
initModelPos 2.0 0.02 -5.0
initModelRot 0.0 2.5132742 0.0
initSpeedVect 0.0 0.0 0.0
mainGearBounce 0.6
mainGearFriction 0.08
mainGearFrictionOrt 1.1
mainGearSpring 100.0
modelGovernors gov1
modelGyros gyro1
modelMass 0.8
modelMotors motor1
modelName body.ac
modelReceivers receiver1
modelServos tailservo elevservo ailservo pitchservo throtservo
modelTransmiters transmiter1
modelType 0.0
noseGearBounce 0.6
noseGearFriction 0.08
noseGearFrictionOrt 1.1
noseGearSpring 100.0
noseGearTurnRatio 0.2
planeType 1.0
renderEnvBlend 1.0
renderFlag 0.0
retractType 1.0
smokeExostPoint 1.5 -0.0 -0.0
smokeExostVect 10.0 0.0 0.0
specialMode 0.0
tailGearBounce 0.6
tailGearFriction 0.08
tailGearFrictionOrt 1.1
tailGearSpring 100.0
tailGearTurnRatio 1.0
useFloats 1.0
useModelInitPos 0.0
verNumber 6.0
#end params
Model Objects Parameters sections
Model consist of many different objects. For each object, there is a section in params.txt file that is named using object type and object name. This section contains the parameters values specific for that object. Objects can be attached or wired one to another just like the components in your real model.
Example 1:
In real helicopter model, a gyro is connected to the receiver channel 4. The tail rotor servo is plugged in into the gyro. The tail rotor servo is linked to the tail rotor and changes the tail rotor pitch via bell crank. In the ClearView model, we will have receiver object, a gyro object, a tail servo object and the tail rotor object.
The corresponding objects will be wired as shown:
#begin receiver.receiver1
breakPartName none
debug 0.0
inputName myTransmitter // the receiver is wired to transmitter object named myTransmitter
inputType transmitter // the transmiter object type is transmitter
#end receiver.receiver1
// Note: this gyro is wired to receiver1, channel 4 - see parameters input1Channel, input1Name and input1Type
#begin gyro.gyro1
breakPartName none
debug 0.0
gain 0.0
gyroAxis y
gyroType 0.0
input1Chanel 4.0
input1Name receiver1
input1Type receiver
input2Chanel 1.0 // this is the gain channel, in this gyro there will be no external gain used, so we do not assign receiver channel
input2Name none
input2Type none
maxDeflectionAngleDeg 0.0
maxRotationsPerSec 0.0
reverseDirection 0.0
#end gyro.gyro1
// Note 1: this tail servo is wired to the gyro, channel 1 - see parameters input1Channel, input1Name and input1Type
// Note 2: this tail servo controls the tail rotor via pitch change - parameter controlledPartMovement is set to input
#begin servo.tailservo
breakPartName none
controlledAxisName z
controlledPartMovement input // use rotate/move/input
controlledPartName none
controlledPartType none
debug 0.0
inputChanel 1.0
inputName gyro1
inputType gyro
servoLinkRatio 1.0
servoLinkTrim 0.0
servoSpeed 0.1
servoType 1.0 // 1=3pole,2=5pole,3=coreless,4=dgtl5pole,5=dgtl/crls
#end servo.tailservo
#begin tailrotor.TailRotor1
... some parameters ...
inputMotorDriveshaftNumber 2.0
inputMotorName motor1
inputMotorType motor
inputPitchChanel 1.0
inputPitchName gyro1
inputPitchType gyro
... some parameters ...
#end tailrotor.TailRotor1
Dragshere
#begin dragsphere.SphereName
breakPartName none
debug 0.0
dragCoef 1.0 - use bigger number for higher drag force, lower for less drag
#end dragsphere.SphereName
Governor
#begin governor.gov1
breakPartName none
debug 0.0
input1Chanel 1.0
input1Name none
input1Type none
input2Chanel 1.0
input2Name none
input2Type none
reverseDirection 0.0
rpm 0.0
#end governor.gov1
Gyro
#begin gyro.gyro1
breakPartName none
debug 0.0
gain 0.0
gyroAxis y
gyroType 0.0
input1Chanel 1.0
input1Name none
input1Type none
input2Chanel 1.0
input2Name none
input2Type none
maxDeflectionAngleDeg 0.0
maxRotationsPerSec 0.0
reverseDirection 0.0
#end gyro.gyro1
Lift Surface
#begin liftsurface.horstab
airfoilDataName NACA-0009 // use: NACA-0009,NACA-0012,NACA-0015 of custom airfoil file name
breakPartName none
debug 0.0
dragCoef 1.0
inducedDragCoef 1.0
liftCoef 1.0
propWashCoef 0.0
propWashDistanceCoef 0.4
renderGroupName horstab
thrustWashName notdefined
#end liftsurface.horstab
Propeller
#begin propeller.Propeller1
airfoilDataName NACA-0009 // use: NACA-0009,NACA-0012,NACA-0015 of custom airfoil file name
breakPartName none
controlSound 1.0
debug 0.0
inputMotorDriveshaftNumber 1.0
inputMotorName none
inputMotorType none
propDiamInch 12.0
propDirection 0.0 // 0 for CD 1 for CCD
propDragAdjustment 1.0
propInducedDragAdjustment 1.0
propLiftAdjustment 1.0
propMass 0.01
propMaxRPM 6000.0
propPitchDegree 6.0
propPitchDegreeMax 16.0
propPitchDegreeMin -16.0
propPitchInch 3.9623365
propPrecessionForce 0.2
propTorqCoef 1.0
propWindmillAdjustment 1.0
renderGroupName Propeller1
translationalMaxSpeedMs 10.0
translationalThrustCoef 0.0
#end propeller.Propeller1
Main Rotor
#begin mainrotor.MainRotor1
airfoilDataName NACA-0009 // use: NACA-0009,NACA-0012,NACA-0015 of custom airfoil file name
breakPartName none
controlSound 0.0
cyclicDragCoef 1.0 // higher for stronger cyclic power sag
cyclicForceCoef 1.0 // higher for faster head speed
debug 0.0
flybarHillerCoef 0.5 // higher for more hiller than bell control
flybarPaddleCoef 1.0 // higher for bigger paddles
flybarTiltAngle 30.0 // max flybar tilt angle
flybarWeightCoef 1.0 // higher for heavier paddles
inputAileChanel 1.0
inputAileName none
inputAileType none
inputElevChanel 1.0
inputElevName none
inputElevType none
inputMotorDriveshaftNumber 1.0
inputMotorName none
inputMotorType none
inputPitchChanel 1.0
inputPitchName none
inputPitchType none
propDiamInch 12.0
propDirection 0.0 // 0 for CD 1 for CCD
propDragAdjustment 1.0
propInducedDragAdjustment 1.0
propLiftAdjustment 1.0
propMass 0.01
propMaxRPM 6000.0
propPitchDegree 6.0
propPitchDegreeMax 16.0
propPitchDegreeMin -16.0
propPitchInch 3.9623365
propPrecessionForce 0.2
propTorqCoef 1.0
propWindmillAdjustment 1.0
renderGroupName MainRotor1
translationalMaxSpeedMs 10.0
translationalThrustCoef 0.0
visualRotorConningCoef 1.0 // stronger conning angle
visualRotorDiskTiltCoef 1.0 // stronger disk tilt
#end mainrotor.MainRotor1
Motor
#begin motor.motor1
breakPartName none
debug 0.0
driveshaft1GearRatio 1.0
driveshaft1OneWayBB 1.0 // 1 for one way ball bearing
driveshaft2GearRatio 5.0
driveshaft2OneWayBB 0.0 // 1 for one way ball bearing
driveshaft3GearRatio 1.0
driveshaft3OneWayBB 0.0 // 1 for one way ball bearing
driveshaft4GearRatio 1.0
driveshaft4OneWayBB 0.0 // 1 for one way ball bearing
engineBrakingCoef 1.0
inputThrotChanel 1.0
inputThrotName none
inputThrotType none
maxRPM 7000.0
motorRotatingMass 0.1
motorRotatingMassDiam 1.0
powerCurveWatts 0.0 90.0 120.0 150.0 150.0 140.0
#end motor.motor1
Receiver
#begin receiver.receiver1
breakPartName none
debug 0.0
inputName none
inputType none
#end receiver.receiver1
Servo
#begin servo.ailservo
breakPartName none
controlledAxisName z
controlledPartMovement rotate // use rotate/move/input
controlledPartName none
controlledPartType none
debug 0.0
inputChanel 1.0
inputName none
inputType none
servoLinkRatio 1.0
servoLinkTrim 0.0
servoSpeed 0.1
servoType 1.0 // 1=3pole,2=5pole,3=coreless,4=dgtl5pole,5=dgtl/crls
#end servo.ailservo
Tail Rotor
#begin tailrotor.TailRotor1
airfoilDataName NACA-0009 // use: NACA-0009,NACA-0012,NACA-0015 of custom airfoil file name
breakPartName none
controlSound 0.0
debug 0.0
inputMotorDriveshaftNumber 1.0
inputMotorName none
inputMotorType none
inputPitchChanel 1.0
inputPitchName none
inputPitchType none
propDiamInch 12.0
propDirection 0.0 // 0 for CD 1 for CCD
propDragAdjustment 1.0
propInducedDragAdjustment 1.0
propLiftAdjustment 1.0
propMass 0.01
propMaxRPM 6000.0
propPitchDegree 6.0
propPitchDegreeMax 16.0
propPitchDegreeMin -16.0
propPitchInch 3.9623365
propPrecessionForce 0.2
propTorqCoef 1.0
propWindmillAdjustment 1.0
renderGroupName TailRotor1
translationalMaxSpeedMs 10.0
translationalThrustCoef 0.0
#end tailrotor.TailRotor1
Transmiter
#begin transmiter.transmiter1
breakPartName none
debug 0.0
expo1 0.0 // between -1,1 negative=smoother around center
expo2 0.0
expo3 0.0
expo4 0.0
expo5 0.0
expo6 0.0
expo7 0.0
expo8 0.0
pitchCurveIdleUp -1.0 -0.5 0.0 0.5 1.0
pitchCurveNormal -1.0 -0.5 0.0 0.5 1.0
pitchCurveThrottleHold -1.0 -0.5 0.0 0.5 1.0
rate1 1.0 // between 0 and 1 , 1=100% rate
rate2 1.0
rate3 1.0
rate4 1.0
rate5 1.0
rate6 1.0
rate7 1.0
rate8 1.0
tailPitchCurveIdleUp 0.0 0.0 0.0 0.0 0.0
tailPitchCurveNormal 0.0 0.0 0.0 0.0 0.0
tailPitchCurveThrottleHold 0.0 0.0 0.0 0.0 0.0
throttleCurveIdleUp -1.0 -0.5 0.0 0.5 1.0
throttleCurveNormal -1.0 -0.5 0.0 0.5 1.0
throttleCurveThrottleHold -1.0 -0.5 0.0 0.5 1.0
trim1 0.0 // between -1,1
trim2 0.0
trim3 0.0
trim4 0.0
trim5 0.0
trim6 0.0
trim7 0.0
trim8 0.0
txmodel 0.0 // 0=raw tx data, 1=heli, 2=plane model
#end transmiter.transmiter1