Stepdance Software Library
Loading...
Searching...
No Matches
ScalingFilter1D Class Reference

Generates an output signal in proportion to one input signal. More...

#include <filters.hpp>

Inheritance diagram for ScalingFilter1D:

Public Member Functions

void begin (uint8_t mode=INCREMENTAL)
 Initializes the ScalingFilter1D with the specified mode.
void set_ratio (ControlParameter ratio)
 Sets the scaling ratio between output and input.
void set_ratio (ControlParameter output_distance, ControlParameter input_distance)
 Sets the scaling ratio using output and input distances.

Public Attributes

BlockPort input
 Input BlockPort. Map upstream components to the input.
BlockPort output
 Output BlockPort. Map downstream components to the output.

Protected Member Functions

void run ()

Detailed Description

Generates an output signal in proportion to one input signal.

The ScalingFilter1D class scales an input signal by a specified ratio to produce an output signal. This is useful for scaling a motion trajectory. Here's an example of how to instantiate and configure a ScalingFilter1D:

#define module_driver
#include "stepdance.hpp"
InputPort input_a;
ScalingFilter1D scale_filter;
Channel channel_x;
OutputPort output_a;
void setup(){
// Initialize OutputPort and enable drivers
output_a.begin(OUTPUT_A);
enable_drivers();
// Initialize Channel
channel_x.begin(&output_a, SIGNAL_E);
input_a.begin(INPUT_A);
input_a.output_x.map(scale_filter.input); // Map InputPort to ScalingFilter1D input
// Initialize ScalingFilter1D and map to channel
scale_filter.set_ratio(2.0); // Example ratio- will scale inpyut by factor of 2
scale_filter.begin();
scale_filter.output.map(channel_x.input_target_position);
dance_start();
}
void loop(){
dance_loop();
}

Member Function Documentation

◆ begin()

void ScalingFilter1D::begin ( uint8_t mode = INCREMENTAL)

Initializes the ScalingFilter1D with the specified mode.

Parameters
modeMode of operation: INCREMENTAL or ABSOLUTE. Default is INCREMENTAL.

◆ set_ratio() [1/2]

void ScalingFilter1D::set_ratio ( ControlParameter output_distance,
ControlParameter input_distance )
inline

Sets the scaling ratio using output and input distances.

Parameters
output_distanceDistance in world units for the output.
input_distanceDistance in world units for the input.

◆ set_ratio() [2/2]

void ScalingFilter1D::set_ratio ( ControlParameter ratio)

Sets the scaling ratio between output and input.

Parameters
ratioScaling ratio (output / input).

The documentation for this class was generated from the following file: