This repository was archived by the owner on Feb 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 50
Header file for VN300 #168
Open
kgrewal26
wants to merge
3
commits into
devel
Choose a base branch
from
vn_sensor_drivers
base: devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| /** | ||
| * VN300 Class to support the IMU and GPS drivers | ||
| */ | ||
|
|
||
| #ifndef VN300_HPP | ||
| #define VN300_HPP | ||
|
|
||
| template <typename Sensor> | ||
| class VN300 { | ||
|
|
||
| public: | ||
| Sensor getSensorInstance(){ | ||
|
|
||
| // If instance is null, get it and set it | ||
| if (s_instance == nullptr){ | ||
| s_instance = Sensor::getInstance(); | ||
| } | ||
|
|
||
| //return | ||
| return s_instance; | ||
| } | ||
|
|
||
| private: | ||
|
|
||
| //A pointer to the existing class instance - nullptr if it doesnt exist | ||
| Sensor* s_instance; | ||
|
|
||
| }; | ||
|
|
||
|
|
||
| struct VN300_GPSData{ | ||
|
|
||
| //Position defining variables | ||
| double latitude; //in deg | ||
| double longitude; //in deg | ||
| double altitude; //in meters | ||
|
|
||
| //Velocity defining variables - they are defined as north, east and downwards positive | ||
| //All in m/s | ||
| float northVel; | ||
| float eastVel; | ||
| float downVel; | ||
|
|
||
| //Position accuracy estimates - indicate how accurate the position readings are | ||
| //All in meters | ||
| float northAcc; | ||
| float eastAcc; | ||
| float downAcc; | ||
|
|
||
| //Other useful accuracy variables | ||
| float speedAcc; //m/s | ||
| float timeAcc; //sec | ||
|
|
||
| //Other useful variables: | ||
|
|
||
| //Time of the GPS weeks in seconds | ||
| double time; | ||
|
|
||
| //The GPS week (1 GPS calendar is 1023 weeks) | ||
| uint16_t week; | ||
|
|
||
| //GNSS Fix type - consult user manual for more info | ||
| uint8_t gnssFix; | ||
|
|
||
| //Number of GNSS satellites being used | ||
| uint8_t numSats; | ||
| }; | ||
|
|
||
|
|
||
| class VN300_GPS { | ||
|
|
||
| public: | ||
|
|
||
| //added to make sure people dont accidentally initialize | ||
| VN300_GPS(const VN300_GPS*) = delete; | ||
|
|
||
| //Pulls new gps data from the VN300 | ||
| void setGPSData(); | ||
|
|
||
| //Returns GPS data struct | ||
| VN300_GPSData getGPSData(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we get a bit more info on the gps data struct
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nvm it's above I found it i'm stupid |
||
|
|
||
| /* | ||
| * Called to either get the existing instance of the class, or create a new one if | ||
| * one currently does not exist | ||
| */ | ||
| static VN300_GPS* GetInstance(); | ||
|
|
||
| private: | ||
|
|
||
| //Private constructor to prevent multiple instances | ||
| VN300_GPS(); | ||
|
|
||
| int registerID; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what would registerID do
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Honestly not too sure yet - I just left it there incase its eventually needed. Will remove it if its not. |
||
|
|
||
| //A pointer to the existing class instance - nullptr if it doesnt exist | ||
| VN300_GPS* instance; | ||
|
|
||
| //Instance of struct to hold the gps data | ||
| VN300_GPSData data; | ||
|
|
||
| }; | ||
| #endif | ||
antholuo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait what does this do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not gonna lie I don't fully remember.
I copied this over from a previous singleton I wrote a while back - If I cant remember the reason for it I'll delete it