FOR BRAD!!!!
Embed:
(wiki syntax)
Show/hide line numbers
LinearBlend.cpp
00001 #include "LinearBlend.h" 00002 #include "mbed.h" 00003 Serial bob(USBTX,USBRX); 00004 00005 /*********************************************************** 00006 Constructor 00007 ***********************************************************/ 00008 LinearBlend::LinearBlend():start(0) 00009 { 00010 } 00011 00012 /*********************************************************** 00013 Initialize Blend Function 00014 ***********************************************************/ 00015 //Function that sets the blend global variables to ready for blending calculations. 00016 void LinearBlend::init(float end, float s, int t_blend) 00017 { 00018 slope=(end-s)/t_blend; 00019 bob.printf("Start: %f, Slope: %f\r\n", start, slope); 00020 start=s; 00021 } 00022 00023 /*********************************************************** 00024 Calculate Blend Function 00025 ***********************************************************/ 00026 //Function that calculates the blending trajectory, point by point. 00027 00028 float* LinearBlend::blend(float ref[]) 00029 { 00030 bob.printf("Start: %f, Slope: %f\r\n", start, slope); 00031 //Pointer to the variable to store the trajectory point for the left side 00032 for(int i=0; i<=t_blend; i++) { 00033 ref[i]=slope*i+start; 00034 00035 } 00036 00037 return ref; 00038 }
Generated on Fri Aug 5 2022 04:52:17 by
1.7.2