RaceCapturePro scripting

From Autosport Labs

Jump to: navigation, search

Contents

Logger Functions

startLogging()

Start logging data to a new logfile, using the current configuration

stopLogging()

Stops a current logging session, if active

setLed(led,state)

Sets a LED to the specified state

  • led : 0-2
  • state : 0=off; 1=on

state isSDCardPresent()

Indicates if an SD Card is inserted

  • state : 1=SD card is present; 0=SD card is missing

state isSDCardWritable()

Indicates if the SD card is writable

  • state : 1=SD card is writable; 0=SD card is write protected

flashLoggerConfig()

Writes the current logger configuration to flash memory

DAC functions

value getAnalog(channel)

Gets the voltage for the specified analog channel

  • channel : 0 - 7
  • value : voltage

value getAnalogRaw(channel)

Gets the raw ADC value for the specified analog channel

  • channel : 0 - 7
  • value : raw ADC value

setAnalogLabel(channel,label,units)

Sets the label for the specified analog channel

  • channel : 0 - 7
  • label : channel label
  • units : channel units label

label,units getAnalogLabel(channel)

Gets the labels for the specified analog channel

  • channel : 0 - 7
  • label : channel label
  • units : channel units label

setAnalogSampleRate(channel,rate)

Sets the sample rate for the specified analog channel

  • channel : 0 - 7
  • rate : sample rate

rate getAnalogSampleRate(channel)

Gets the sample rate for the specified analog channel

  • channel : 0 - 7
  • rate : sample rate

setAnalogScaling(channel,scaling)

Sets the scaling value for the specified analog channel

  • channel : 0 - 7
  • scaling : the decimal scaling value for the specified analog channel. Logged values are multiplied by this scaling value.

scaling getAnalogScaling(channel)

Get the scaling value for the specified analog channel

  • channel : 0 - 7
  • scaling : the decimal scaling value for the specified analog channel. Logged values are multiplied by this scaling value.

PWM / DAC functions

setAnalogOut(channel,voltage)

Sets the analog output voltage for the specified PWM/DAC channel

  • channel : 0 - 3
  • voltage : 0.00 - 5.00

Sets the duty cycle percentage for the specified PWM/DAC channel

setPwmDutyCycle(channel,duty)

  • channel : 0 - 3
  • duty : duty cycle 0-100

setPwmDutyCycleRaw(channel,duty)

Sets the raw duty cycle value for the specified PWM/DAC channel

  • channel : 0 - 3
  • duty : duty cycle 0-100

setPwmPeriod(channel,period)

Sets the period for the specified PWM channel

  • channel : 0 - 3
  • period : <TODO define this>

setPwmPeriodRaw(channel,period)

Sets the raw period value for the specified PWM/DAC channel

  • channel : 0 - 3
  • period : <TODO define this>

setPwmClockFrequency(frequency)

Sets the clock frequency for the PWM/DAC generator

  • frequency : the base PWM frequency (10 - 2000)

frequency getPwmClockFrequency()

Gets the clock frequency for the PWM/DAC generator

  • frequency : the base PWM frequency (10 - 2000)

setPwmLabel(channel,label)

Sets the label for the specified PWM/DAC channel

  • channel : 0 - 3
  • label : channel label

label getPwmLabel()

Gets the label for the specified PWM/DAC channel

  • channel : 0 - 3
  • label : channel label

setPwmSampleRate(channel,rate)

Sets the sample rate for the specified PWM/DAC channel

  • channel : 0 - 3
  • rate : sample rate

label getPwmSampleRate(channel)

Gets the sample rate for the specified PWM/DAC channel

  • channel : 0 - 3
  • label : channel label

setPwmOutputConfig(channel,config)

Sets the configuration for the specified PWM/DAC channel

  • channel : 0 - 3
  • config : 0=analog; 1=frequency

config getPwmOutputConfig(channel)

Gets the configuration for the specified PWM/DAC channel

  • channel : 0 - 3
  • config : 0=analog; 1=frequency

setPwmLoggingConfig(channel,config)

Sets the Logging configuration for the specified PWM/DAC channel

  • channel : 0 - 3
  • config : 0=Log PWM Period; 1=Log PWM Duty Cycle; 2=Log DAC volts

config getPwmLoggingConfig(channel)

Gets the Logging configuration for the specified PWM/DAC channel

  • channel : 0 - 3
  • config : 0=Log PWM Period; 1=Log PWM Duty Cycle; 2=Log DAC volts

setPwmStartupDutyCycle(channel,duty)

Sets the startup PWM duty cycle for the specified PWM/DAC channel

  • channel : 0 - 3
  • duty : duty cycle 0 - 100

channel getPwmStartupDutyCycle(duty)

Gets the startup duty cycle for the specified PWM/DAC channel

  • channel : 0 - 3
  • duty : duty cycle 0 - 100

setPwmStartupPeriod(channel,period)

Sets the startup period for the specified PWM/DAC channel

  • channel : 0 - 3
  • period : period 1 - 2000

period getPwmStartupPeriod(channel)

Gets the startup period for the specified PWM/DAC channel

  • channel : 0 - 3
  • period : period 1 - 2000

setPwmVoltageScaling(channel,scaling)

Sets the voltage scaling for the specified PWM/DAC channel. Used when in DAC mode

  • channel : 0 - 3
  • scaling : voltage scaling

scaling getPwmVoltageScaling(channel)

Gets the voltage scaling for the specified PWM/DAC channel. Used when in DAC mode

  • channel : 0 - 3
  • scaling : voltage scaling

Timer functions

rpm getTimerRpm(channel)

Gets the calculated RPM for the specified timer channel

  • channel : 0 - 2
  • rpm : value, in RPM

period getTimerPeriodMs(channel)

Gets the calculated period, in mS, for the specified timer channel

  • channel : 0 - 2
  • period : value, in mS

period getTimerPeriodUsec(channel)

Gets the calculated period, in uS, for the specified timer channel

  • channel : 0 - 2
  • period : value, in uS

freq getTimerFrequency(channel)

Gets the calculated frequency, in Hz, for the specified timer channel

  • channel : 0 - 2
  • freq : value, in Hz

value getTimerRaw(channel)

Gets the raw value for the specified timer channel

  • channel : 0 - 2
  • value : raw timer count value

count getTimerCount(channel)

Gets the count value for the specified timer channel, when configured as a slow timer

  • channel : 0 - 2
  • count : slow timer counts

resetTimerCount(channel)

Resets the count value for the timer channel, when configured as a slow timer

  • channel : 0 - 2

setTimerLabel(channel,label,units)

Sets the labels for the the specified timer channel

  • channel : timer channel 0 - 2
  • label : channel label
  • units : units label

label,units getTimerLabel(channel)

Gets the labels for the the specified timer channel

  • channel : timer channel 0 - 2
  • label : channel label
  • units : units label

setTimerSampleRate(channel)

Sets the sample rate for the specified timer channel

  • channel : timer channel 0 - 2
  • rate : sample rate

rate getTimerSampleRate(channel)

Gets the sample rate for the specified timer channel

  • channel : timer channel 0 - 2
  • rate : sample rate

setTimerConfig(channel,config)

Sets the configuration for the specified timer channel

  • channel : timer channel 0 - 2
  • configuration : 0 = RPM; 1 = frequency(Hz) ; 2 = period(uS) ; 3 = period(mS)

config getTimerConfig(channel)

Gets the configuration for the specified timer channel

  • channel : timer channel 0 - 2
  • configuration : 0 = RPM; 1 = frequency(Hz) ; 2 = period(uS) ; 3 = period(mS)

setTimerPulsePerRevolution(channel,value)

Sets the pulse-per-revolution for the specified timer channel.

  • channel : timer channel 0 - 2
  • value' : the number of pulses representing a complete revolution of a rotational device (crankshaft, wheel, etc)

value getTimerPulsePerRevolution(channel)

Gets the pulse-per-revolution for the specified timer channel.

  • channel : timer channel 0 - 2
  • value : the number of pulses representing a complete revolution of a rotational device (crankshaft, wheel, etc)

setTimerDivider(channel,divider)

Sets the clock divider for the specified timer channel.

  • channel : timer channel 0 - 2
  • divider : 2 = Master Clock / 2; 8 = Master Clock / 8; 32 = Master Clock / 32; 128 = Master Clock / 128; 1024 = Master Clock / 1024

divider getTimerDivider(channel)

Gets the clock divider for the specified timer channel.

  • channel : timer channel 0 - 2
  • divider : 2 = Master Clock / 2; 8 = Master Clock / 8; 32 = Master Clock / 32; 128 = Master Clock / 128; 1024 = Master Clock / 1024

calculateTimerScaling(channel)

Recalculates the timer scaling, from the current timer divider and pulse per revolution values for the specified channel.

  • channel : timer channel 0 - 2

value getTimerScaling(channel)

Gets the current calculated scaling value for the specified timer channel

  • channel : timer channel 0 - 2
  • value : the current scaling value

GPIO functions

state getGpio(port)

Provides the state of the specified GPIO port.

  • port : 0 - 2
  • state : 0=low; 1=high

setGpio(port,state)

Sets a GPIO port to the specified state

  • port : 0 - 2
  • state : 0=low;1=high

setGpioLabel(port,label)

Sets the label for the specified GPIO port

  • port : GPIO port 0 - 2
  • label : label

label getGpioLabel(port)

Gets the label for the specified GPIO port

  • port : GPIO port 0 - 2
  • label : label

setGpioSampleRate(port,rate)

Sets the sample rate for the specified GPIO port

  • port : GPIO port 0 - 2
  • rate : sample rate

rate getGpioSampleRate(port)

  • port : GPIO port 0 - 2
  • rate : sample rate

config setGpioConfig(port,config)

Sets the configuration of the specified GPIO port

  • port : GPIO port 0 - 2
  • config : 0 = configure as input; 1 = configure as output

config getGpioConfig(port)

Gets the configuration of the specified GPIO port

  • port : GPIO port 0 - 2
  • config : 0 = configure as input; 1 = configure as output

state getButton()

Returns the status of the front panel button

  • state 1=button pressed; 0=button not pressed

Accelerometer functions

value readAccel(channel)

TODO document Yaw Sensor Reads the specified Accelerometer channel

  • channel : 0-3
  • value : The accelerometer value, in G

value readAccelRaw(channel)

Reads the specified Accelerometer channel

  • channel : 0-3
  • value : The raw accelerometer value

setAccelInstalled(installed)

Sets the installed state of the accelerometer module

  • installed : 1 = installed; 0 = not installed

installed getAccelInstalled()

Gets the installed state of the accelerometer module

  • installed : 1 = installed; 0 = not installed

setAccelLabel(channel,label)

Sets the label for the specified accelerometer channel

  • channel : accerometer channel 0 - 3
  • label : channel label

label getAccelLabel(channel)

Gets the label for the specified accelerometer channel

  • channel : accerometer channel 0 - 3
  • label : channel label

setAccelSampleRate(channel,rate)

Sets the sample rate for the specified accelerometer channel

  • channel : accerometer channel 0 - 3
  • rate : sample rate

rate getAccelSampleRate(channel)

Gets the sample rate for the specified accelerometer channel

  • channel : accerometer channel 0 - 3
  • rate : sample rate

setAccelIdleSampleRate(channel,rate)

Sets the sample rate for the specified accelerometer channel when not logging

  • channel : accerometer channel 0 - 3
  • rate : sample rate

rate getAccelIdleSampleRate(channel)

Gets the sample rate for the specified accelerometer channel when not logging

  • channel : accerometer channel 0 - 3
  • rate : sample rate

setAccelConfig(channel,config)

Sets the configuration for the specified accelerometer channel

  • channel : accerometer channel 0 - 3
  • config : 0 = disabled ; 1 = normal orientation; 2 = inverted orientation

config getAccelConfig(channel)

Gets the configuration for the specified accelerometer channel

  • channel : accerometer channel 0 - 3
  • config : 0 = disabled ; 1 = normal orientation; 2 = inverted orientation

setAccelChannel(physical,logical)

Maps the logical channel to the specified physical accelerometer channel

  • physical : Physical accelerometer port : 0 = X; 1 = Y; 2 = Z; 3 = Yaw
  • logical : Logical accelerometer port : 0 = X; 1 = Y; 2 = Z; 3 = Yaw

logical getAccelChannel(physical)

Gets the logical mapping for the specified physical accelerometer channel

  • physical : Physical accelerometer port : 0 = X; 1 = Y; 2 = Z; 3 = Yaw
  • logical : Logical accelerometer port : 0 = X; 1 = Y; 2 = Z; 3 = Yaw

setAccelZeroValue(channel,value)

Sets the zero or resting value for the specified accelerometer channel

  • channel : accelerometer channel 0 - 3
  • value : zero value

value getAccelZeroValue(channel)

Gets the zero or resting value for the specified accelerometer channel

  • channel : accelerometer channel 0 - 3
  • value : zero value

calibrateAccelZero()

Perform automatic zero calibration of all accelerometer channels

GPS functions

TODO- consider collapsing this into a lat,long = GetGPSLocation() function

value getGPSLatitude()

Gets the current GPS Latitude

  • value : GPS Latitude in decimal degrees

value getGPSLongitude()

Gets the current GPS Longitude

  • value : GPS Longitude in decimal degrees

value getGPSVelocity()

Gets the current GPS velocity

  • value : GPS velocity in Kph

value getGPSQuality()

Gets the current GPS Quality indicator TODO find out the values

  • value : the GPS quality indicator

value getGPSTime()

Gets the current GPS time of day

  • value : the current GPS time of day, in UTC decimal format

value getGPSSecondsSinceMidnight()

Gets the current GPS time of day, in seconds since midnight

  • value : decimal seconds since midnight

value getTimeDiff(from,to)

Calculates the period between the specified time, within a 24 hour period. Accounts for midnight transition.

  • from : from time, in seconds since midnight
  • to : to time, in seconds since midnight
  • value : time difference, in seconds since midnight

value getTimeSince(time)

Calculates period between the current GPS time and the specified time, within a 24 hour period. Accounts for midnight transition.

  • time : the from time, in seconds since midnight
  • value : time since, in seconds since midnight

setGPSInstalled(installed)

Sets the installation state of the GPS feature

  • installed : 1 = GPS installed; 0 = GPS not installed

installed getGPSInstalled()

Gets the installation state of the GPS feature

  • installed : 1 = GPS nstalled; 0 = GPS not installed

setGPSQualityLabel(label)

Sets the label for the GPS quality field

  • label : label

label getGPSQualityLabel()

Gets the label for the GPS quality field

  • label : label

setGPSSatsLabel(label)

Sets the label for the GPS stats field

  • label : label

label getGPSSatsLabel()

Sets the label for the GPS stats field

  • label : label

setGPSLatitudeLabel(label)

Sets the label for the GPS latitude field

  • label : label

label getGPSLatitudeLabel()

Gets the label for the GPS latitude field

  • label : label

setGPSLongitudeLabel(label)

Sets the label for the GPS Longitude field

  • label : label

label getGPSLongitudeLabel()

Gets the label for the GPS Longitude field

  • label : label

setGPSTimeLabel(label)

Sets the label for the GPS time field

  • label : label

label getGPSTimeLabel()

Gets the label for the GPS time field

  • label : label

setGPSVelocityLabel(label)

Sets the GPS velocity label

  • label : label

label getGPSVelocityLabel()

Gets the GPS velocity label

  • label : label

setGPSPositionSampleRate(rate)

Sets the sample rate for the GPS position

  • rate : sample rate

rate getGPSPositionSampleRate()

Gets the sample rate for the GPS position

  • rate : sample rate

setGPSVelocitySampleRate(rate)

Sets the sample rate for the GPS velocity

  • rate : sample rate

rate getGPSVelocitySampleRate()

Gets the sample rate for the GPS velocity

  • rate : sample rate

setGPSTimeSampleRate(rate)

Sets the sample rate for the GPS time

  • rate : sample rate

getGPSTimeSampleRate()

Gets the sample rate for the GPS time

  • rate : sample rate

Serial Port functions

data readSerial(port)

Reads a line from the specified serial port

  • port : 0 - 1
  • data : The read string

writeSerial(port,data)

Writes a string to the specified serial port

  • port : 0 - 1
  • data : data to write

Supported Sample Rates

  • 0 - Sampling disabled
  • 1 - 1Hz
  • 5 - 5Hz
  • 10 - 10Hz
  • 20 - 20Hz
  • 30 - 30Hz
  • 50 - 50Hz
  • 100 - 100Hz
Personal tools