ഗൈറോ സെൻസർ#

ആമുഖം#

റോബോട്ടിന്റെ തലക്കെട്ടും ഭ്രമണ ചലനവും അളക്കാൻ gyro ക്ലാസ് ഉപയോഗിക്കുന്നു, ഇത് കാലക്രമേണ ഓറിയന്റേഷൻ ട്രാക്ക് ചെയ്യാൻ അനുവദിക്കുന്നു.

ക്ലാസ് കൺസ്ട്രക്റ്റർ#

gyro(
  triport::port &port);

ക്ലാസ് ഡിസ്ട്രക്റ്റർ#

gyro ഒബ്‌ജക്റ്റിനെ നശിപ്പിക്കുകയും അനുബന്ധ ഉറവിടങ്ങൾ പുറത്തുവിടുകയും ചെയ്യുന്നു.

virtual ~gyro();

പാരാമീറ്ററുകൾ#

പാരാമീറ്റർ

ടൈപ്പ് ചെയ്യുക

വിവരണം

port

triport::port &

ഗൈറോ സെൻസർ ബന്ധിപ്പിച്ചിരിക്കുന്ന 3-വയർ പോർട്ട്, Brain.ThreeWirePort.X അല്ലെങ്കിൽ ExpanderName.Xഎന്ന് എഴുതിയിരിക്കുന്നു, ഇവിടെ X എന്നത് പോർട്ട് അക്ഷരമാണ് (ഉദാഹരണത്തിന്, Brain.ThreeWirePort.A അല്ലെങ്കിൽ Expander1.A).

ഉദാഹരണം#

// Create a gyro instance in Port A
gyro GyroA = gyro(Brain.ThreeWirePort.A);

അംഗ പ്രവർത്തനങ്ങൾ#

gyro ക്ലാസ്സിൽ ഇനിപ്പറയുന്ന അംഗ ഫംഗ്‌ഷനുകൾ ഉൾപ്പെടുന്നു:

  • calibrate — സ്ഥിരതയുള്ള ഹെഡിംഗ് ട്രാക്കിംഗിനായി ഗൈറോ കാലിബ്രേറ്റ് ചെയ്യുന്നു.

  • setHeading — ഗൈറോയുടെ തലക്കെട്ട് സജ്ജമാക്കുന്നു.

  • setRotation — ഗൈറോയുടെ നിലവിലെ ഭ്രമണ മൂല്യം സജ്ജമാക്കുന്നു.

  • heading — ഗൈറോയുടെ തലക്കെട്ട് നൽകുന്നു.

  • rotation — ഗൈറോയുടെ ഭ്രമണം നൽകുന്നു.

ഏതെങ്കിലും gyro അംഗ ഫംഗ്ഷനുകൾ വിളിക്കുന്നതിന് മുമ്പ്, താഴെ കാണിച്ചിരിക്കുന്നതുപോലെ ഒരു gyro ഉദാഹരണം സൃഷ്ടിക്കണം:

/* This constructor is required when using VS Code.
Gyro Sensor configuration is generated automatically
in VEXcode using the Device Menu. Replace the values
as needed. */

// Create a gyro instance in Port A
gyro GyroA = gyro(Brain.ThreeWirePort.A);

calibrate#

ഗൈറോ സെൻസർ കാലിബ്രേറ്റ് ചെയ്യുന്നു.

Available Functions
void calibrate(
  int32_t value = 0 );

Parameters

പാരാമീറ്ററുകൾ

ടൈപ്പ് ചെയ്യുക

വിവരണം

value

int32_t

കാലിബ്രേറ്റ് ചെയ്യാൻ എടുക്കുന്ന സമയം സെക്കൻഡുകളിൽ. ഡിഫോൾട്ട് 0 ആണ്.

Return Values

ഈ ഫംഗ്ഷൻ ഒരു മൂല്യം തിരികെ നൽകുന്നില്ല.

Notes
  • സെൻസർ ചലിക്കാത്തപ്പോൾ മാത്രമേ calibrate വിളിക്കാവൂ.

Examples
// Start calibration with the calibration time set to 3 seconds.
GyroA.calibrate(3);

setHeading#

ഗൈറോ സെൻസറിന്റെ ഹെഡിംഗ് ഒരു പ്രത്യേക മൂല്യത്തിലേക്ക് സജ്ജമാക്കുന്നു.

Available Functions
void setHeading(
  double        value,
  rotationUnits units );

പാരാമീറ്ററുകൾ

ടൈപ്പ് ചെയ്യുക

വിവരണം

value

double

പുതിയ തലക്കെട്ടിന് ഉപയോഗിക്കേണ്ട മൂല്യം.

units

rotationUnits

തലക്കെട്ടിനെ പ്രതിനിധീകരിക്കുന്ന യൂണിറ്റ്:

  • degrees
  • turns
Return Values

ഈ ഫംഗ്ഷൻ ഒരു മൂല്യം തിരികെ നൽകുന്നില്ല.

setRotation#

ഗൈറോ സെൻസറിന്റെ ഭ്രമണം ഒരു പ്രത്യേക മൂല്യത്തിലേക്ക് സജ്ജമാക്കുന്നു.

Available Functions
void setRotation(
  double        value,
  rotationUnits units );

Parameters

പാരാമീറ്ററുകൾ

ടൈപ്പ് ചെയ്യുക

വിവരണം

value

double

പുതിയ റൊട്ടേഷൻ മൂല്യത്തിന് ഉപയോഗിക്കേണ്ട മൂല്യം.

units

rotationUnits

ഭ്രമണ മൂല്യത്തെ പ്രതിനിധീകരിക്കുന്ന യൂണിറ്റ്:

  • degrees
  • turns
Return Values

ഈ ഫംഗ്ഷൻ ഒരു മൂല്യം തിരികെ നൽകുന്നില്ല.

heading#

ഗൈറോ സെൻസറിന്റെ നിലവിലെ തലക്കെട്ട് നൽകുന്നു.

Available Functions
double heading(
  rotationUnits units = degrees );

Parameters

പാരാമീറ്റർ

ടൈപ്പ് ചെയ്യുക

വിവരണം

units

rotationUnits

തലക്കെട്ടിനെ പ്രതിനിധീകരിക്കുന്ന യൂണിറ്റ്:

  • degrees (സ്ഥിരസ്ഥിതി)
  • turns
Return Values

നിർദ്ദിഷ്ട യൂണിറ്റുകളിലെ ഗൈറോ സെൻസറിന്റെ നിലവിലെ ഹെഡിംഗിനെ പ്രതിനിധീകരിക്കുന്ന double നൽകുന്നു, ഡിഫോൾട്ട് degrees ആയി മാറുന്നു.

Examples
// Get the current heading for the Gyro.
double value = GyroA.heading();
Brain.Screen.print(value);

rotation#

ഗൈറോ സെൻസറിന്റെ നിലവിലെ ഭ്രമണം നൽകുന്നു.

Available Functions
double rotation(
  rotationUnits units = degrees );

Parameters

പാരാമീറ്റർ

ടൈപ്പ് ചെയ്യുക

വിവരണം

units

rotationUnits

ഭ്രമണ മൂല്യത്തെ പ്രതിനിധീകരിക്കുന്ന യൂണിറ്റ്:

  • degrees (സ്ഥിരസ്ഥിതി)
  • turns
Return Values

നിർദ്ദിഷ്ട യൂണിറ്റുകളിലെ ഗൈറോ സെൻസറിന്റെ നിലവിലെ റൊട്ടേഷൻ മൂല്യത്തെ പ്രതിനിധീകരിക്കുന്ന double നൽകുന്നു, ഡിഫോൾട്ട് degrees ആയി മാറുന്നു.

Examples
// Get the current rotation for the Gyro.
double value = GyroA.rotation();
Brain.Screen.print(value);