Skip to content

Comments

Add NeuroPawn Knight IMU Board Support and Gain Configuration#795

Open
neuropawn-admin wants to merge 1 commit intobrainflow-dev:masterfrom
NeuroPawn:master
Open

Add NeuroPawn Knight IMU Board Support and Gain Configuration#795
neuropawn-admin wants to merge 1 commit intobrainflow-dev:masterfrom
NeuroPawn:master

Conversation

@neuropawn-admin
Copy link

This PR introduces support for the NeuroPawn Knight IMU board and adds gain configuration capabilities for Knight boards.

Key Changes:

  1. New Board Support:
  • Added KnightIMU class (src/board_controller/neuropawn/knightimu.h and .cpp) to handle data acquisition and parsing for the Knight IMU board (Board ID: 66, NEUROPAWN_KNIGHT_BOARD_IMU)
  • Updated BrainFlowBoards definitions in src/board_controller/brainflow_boards.cpp to include the new board constants and default settings
  • Updated BoardController factory in src/board_controller/board_controller.cpp to initialize the KnightIMU board
  1. Gain Configuration
  • Updated Knight and KnightIMU classes to parse gain settings from the params.other_info JSON string (e.g., '{"gain": 6}')
  • Supported gain values: 1, 2, 3, 4, 6, 8, 12 (default is 12)
  • Fixed a scaling bug related to ADC handling in knight.cpp
  1. Documentation
  • Updated docs/SupportedBoards.rst to document usage of the Knight IMU board.
  • Refined initialization examples to demonstrate how to configure gain and select between Knight and Knight IMU boards using BoardIds

Co-authored-by: Kevin <kevinx1698@gmail.com>
Co-authored-by: Kevin-Xue01 <59587075+Kevin-Xue01@users.noreply.github.com>
Co-authored-by: aa217 <125326241+aa217@users.noreply.github.com>
Co-authored-by: abdallah <abdallah.alwan2001@gmail.com>
Copy link
Member

@Andrey1994 Andrey1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks good, in addition to comments attached to code I think it would be better to have a common base class for both Knigh boards and implement different parsing logic since everything else looks the same. Good example how to do it - OpenBCISerial board and Cyton/CytonDaisy implementations

To create such board you need to specify the following board ID and fields of BrainFlowInputParams object:

- :code:`BoardIds.NEUROPAWN_KNIGHT_BOARD`
- :code:`BoardIds.NEUROPAWN_KNIGHT_BOARD` or :code:`BoardIds.NEUROPAWN_KNIGHT_BOARD_IMU`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add new entry please to this board like its done for other devices, dont mix it with or under the same section

gain = 12; // default gain value

// Parse gain from other_info if provided
if (!params.other_info.empty ())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this logic from constructor to prepare_session method and return proper error code if its invalid

gain = 12; // default gain value

// Parse gain from other_info if provided
if (!params.other_info.empty ())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here


from brainflow.board_shim import BoardShim, BrainFlowInputParams, BoardIds

class KnightBoard:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readmes are not used mostly in brainflow, would be better to move to python examples and I will use code snippit for blog post update, etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants