BGE: Sensor.frequency is badly named #42341

Closed
opened 2014-10-22 09:57:02 +02:00 by inactive account · 12 comments

The BGE class Sensor has a property frequency , that determines the frequency of the pulses it emits.

Expected behaviour: increase the property to increase the frequency of the pulses.
Observed behaviour: increasing the property decreases the frequency of the pulses.

The tooltip notes that it's actually the "Delay between repeated pulses". This matches the observed behaviour.

Based on these observations, the name "frequency" seems wrong, and "period" would be a better name, as this is the reciprocal of frequency .

Note that if only the name is changed to "period", it would still also require a change in values in order to be correct. Right now "frequency = 0" indicates a period of 1; "frequency = 1" indicates a period of 2, and so on.

I understand that changing a property name is not something trivial, as it introduces incompatibility with existing code/files. However, I do feel that this issue should be addressed, for two reasons:

  • The name "frequency" doesn't match the behaviour.
  • The property name and its tooltip are in conflict.

PS: If I'm really nitpicky about this, even the word "delay" in the tooltip is a misnomer. If somebody ships 100 DVDs to a customer, and they are delayed, in the end all 100 DVDs still get delivered, or people wouldn't speak of "delaying" but "losing" or "misplacing". However, with 100 pulses and "frequency = 3", only 25 pulses would be "delivered".

The BGE class Sensor has a property [frequency ](http://www.blender.org/documentation/blender_python_api_2_72_release/bpy.types.Sensor.html#bpy.types.Sensor.frequency), that determines the frequency of the pulses it emits. **Expected behaviour:** increase the property to *increase* the frequency of the pulses. **Observed behaviour:** increasing the property *decreases* the frequency of the pulses. The tooltip notes that it's actually the "Delay between repeated pulses". This matches the observed behaviour. Based on these observations, **the name "frequency" seems wrong**, and "period" would be a better name, as [this is the reciprocal of frequency ](http://en.wikipedia.org/wiki/Frequency). Note that if only the name is changed to "period", it would still **also require a change in values** in order to be correct. Right now "frequency = 0" indicates a period of 1; "frequency = 1" indicates a period of 2, and so on. I understand that changing a property name is not something trivial, as it introduces incompatibility with existing code/files. However, I do feel that this issue should be addressed, for two reasons: - The name "frequency" doesn't match the behaviour. - The property name and its tooltip are in conflict. PS: If I'm really nitpicky about this, even the word "delay" in the tooltip is a misnomer. If somebody ships 100 DVDs to a customer, and they are delayed, in the end all 100 DVDs still get delivered, or people wouldn't speak of "delaying" but "losing" or "misplacing". However, with 100 pulses and "frequency = 3", only 25 pulses would be "delivered".

Changed status to: 'Open'

Changed status to: 'Open'

Added subscriber: @sybrenstuvel

Added subscriber: @sybrenstuvel
Member

Added subscriber: @LukasTonne

Added subscriber: @LukasTonne
Member

Added subscriber: @JorgeBernalMartinez

Added subscriber: @JorgeBernalMartinez
Member

Maybe we should change the tooltip to "Number of pulses omitted between 2 active pulses (in logic tics, 0 = no pulses omitted)" and the "Freq:" by "Omit:".

We could also change "freq" or "m_pulse_frequency" internal variables to a name more appropiated but I'm not totally convince of this one.

Maybe we should change the tooltip to "Number of pulses omitted between 2 active pulses (in logic tics, 0 = no pulses omitted)" and the "Freq:" by "Omit:". We could also change "freq" or "m_pulse_frequency" internal variables to a name more appropiated but I'm not totally convince of this one.

Added subscriber: @dr.sybren

Added subscriber: @dr.sybren

In #42341#301495, @JorgeBernalMartinez wrote:
Maybe we should change the tooltip to "Number of pulses omitted between 2 active pulses (in logic tics, 0 = no pulses omitted)"

For me "Number of pulses omitted (in logic ticks)" is hard to understand, as it implies that you can count pulses in logic ticks, whereas this setting is exactly there to change the relation between pulses and logic ticks.

"Number of logic ticks between 2 active pulses (0 = pulse every logic tick, 1 = skip 1 logic tick between pulses, etc.)" may be clearer.

and the "Freq:" by "Omit:".

I'm partial to either "period" or "skip" rather than "omit".

We could also change "freq" or "m_pulse_frequency" internal variables to a name more appropiated but I'm not totally convince of this one.

IMO that would certainly be an improvement. "period" would stop my head from hurting every time I see that variable name. Naming something the exact opposite of what it represents, which is the current situation, is Not Good.

> In #42341#301495, @JorgeBernalMartinez wrote: > Maybe we should change the tooltip to "Number of pulses omitted between 2 active pulses (in logic tics, 0 = no pulses omitted)" For me "Number of pulses omitted (in logic ticks)" is hard to understand, as it implies that you can count pulses in logic ticks, whereas this setting is exactly there to change the relation between pulses and logic ticks. "Number of logic ticks between 2 active pulses (0 = pulse every logic tick, 1 = skip 1 logic tick between pulses, etc.)" may be clearer. > and the "Freq:" by "Omit:". I'm partial to either "period" or "skip" rather than "omit". > We could also change "freq" or "m_pulse_frequency" internal variables to a name more appropiated but I'm not totally convince of this one. IMO that would certainly be an improvement. "period" would stop my head from hurting every time I see that variable name. Naming something the exact opposite of what it represents, which is the current situation, is Not Good.
Member

Removed subscriber: @LukasTonne

Removed subscriber: @LukasTonne
Member

In #42341#301561, @dr.sybren wrote:

For me "Number of pulses omitted (in logic ticks)" is hard to understand, as it implies that you can count pulses in logic ticks, whereas this setting is exactly there to change the relation between pulses and logic ticks.

"Number of logic ticks between 2 active pulses (0 = pulse every logic tick, 1 = skip 1 logic tick between pulses, etc.)" may be clearer.

Ok. Much better.

I'm partial to either "period" or "skip" rather than "omit".

I'm for "skip" as it will avoid a do_versions to convert from 0 to 1 as default value (and also avoid internal logic coversion)

IMO that would certainly be an improvement. "period" would stop my head from hurting every time I see that variable name. Naming something the exact opposite of what it represents, which is the current situation, is Not Good.

Following above election then i would use: tics_skipped, m_tics_skipped, ticskip, etc

If you are agree, I have a patch ready to upload to differential.

> In #42341#301561, @dr.sybren wrote: > > For me "Number of pulses omitted (in logic ticks)" is hard to understand, as it implies that you can count pulses in logic ticks, whereas this setting is exactly there to change the relation between pulses and logic ticks. > > "Number of logic ticks between 2 active pulses (0 = pulse every logic tick, 1 = skip 1 logic tick between pulses, etc.)" may be clearer. Ok. Much better. > > I'm partial to either "period" or "skip" rather than "omit". > I'm for "skip" as it will avoid a do_versions to convert from 0 to 1 as default value (and also avoid internal logic coversion) > > IMO that would certainly be an improvement. "period" would stop my head from hurting every time I see that variable name. Naming something the exact opposite of what it represents, which is the current situation, is Not Good. Following above election then i would use: tics_skipped, m_tics_skipped, ticskip, etc If you are agree, I have a patch ready to upload to differential.

In #42341#301584, @JorgeBernalMartinez wrote:
If you are agree, I have a patch ready to upload to differential.

Fire it up! :)

> In #42341#301584, @JorgeBernalMartinez wrote: > If you are agree, I have a patch ready to upload to differential. Fire it up! :)
Member

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Jorge Bernal self-assigned this 2015-04-16 06:54:26 +02:00
Member

Closed by commit 8c98b1649d

Closed by commit 8c98b1649d
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#42341
No description provided.