-
Notifications
You must be signed in to change notification settings - Fork 1
Spike monitoring #326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Spike monitoring #326
Conversation
|
This looks really good and I can confirm that it works when I switch to your branch!!! Now for my critiques
On a different note, I pulled main into this branch and will push it now. So you can now make relative movments using commands
This will make the submarine move relative to its current position. If you choose to omit some of the values like
Then the rest of the values will be assumed to be zero. I think it would be good to use this command to test your monitor. I used it to test hitting the ground and IT WORKED! Overall good job |
Carlosdc25
left a comment
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.
Followed the comments I made previously
mohana-pamidi
left a comment
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.
Great Job Emily!
Tomorrow we will be testing the monitoring a little more, including seeing if it detects a spike when the sub is moving at a constant velocity and stops suddenly.
As mentioned by Carlos, we will be moving the monitoring script to it's own package (not in localization), and instead of republishing the sensor data, we will be publishing spike detection messages.
| self.pub_dvl_ = self.create_publisher(Odometry, "monitoring_dvl", 10) | ||
| self.pub_imu_ = self.create_publisher(Imu, "monitoring_imu", 10) | ||
|
|
||
| self.create_subscription(Odometry, "dvl/odom", self.dvl_odom_callback, 10) | ||
| self.create_subscription(Imu, "imu/data", self.imu_data_callback, 10) |
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.
No need to publish the same message type. I would suggest publishing your own message type that has monitoring metrics of interest
| def dvl_odom_callback(self, dmsg: Odometry): | ||
| self.pub_dvl_.publish(dmsg) |
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.
why are we republishing?
| # create running average for relevant measurements: | ||
| # acceleration x |
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.
Use docstrings:
| # create running average for relevant measurements: | |
| # acceleration x | |
| """ | |
| create running average for relevant measurements: | |
| acceleration x | |
| """ |
| if len(self.imu_accelerationx_array) <= 20: | ||
| self.imu_accelerationx_array.append(imsg.linear_acceleration.x) | ||
| else: | ||
| imu_accelerationx_avg = ( | ||
| abs(self.imu_accelerationx_array[0]) | ||
| + abs(self.imu_accelerationx_array[1]) | ||
| + abs(self.imu_accelerationx_array[2]) | ||
| + abs(self.imu_accelerationx_array[3]) | ||
| + abs(self.imu_accelerationx_array[4]) | ||
| + abs(self.imu_accelerationx_array[5]) | ||
| + abs(self.imu_accelerationx_array[6]) | ||
| + abs(self.imu_accelerationx_array[7]) | ||
| + abs(self.imu_accelerationx_array[8]) | ||
| + abs(self.imu_accelerationx_array[9]) | ||
| + abs(self.imu_accelerationx_array[10]) | ||
| + abs(self.imu_accelerationx_array[11]) | ||
| + abs(self.imu_accelerationx_array[12]) | ||
| + abs(self.imu_accelerationx_array[13]) | ||
| + abs(self.imu_accelerationx_array[14]) | ||
| + abs(self.imu_accelerationx_array[15]) | ||
| + abs(self.imu_accelerationx_array[16]) | ||
| + abs(self.imu_accelerationx_array[17]) | ||
| + abs(self.imu_accelerationx_array[18]) | ||
| + abs(self.imu_accelerationx_array[19]) | ||
| ) / len(self.imu_accelerationx_array) | ||
| percent_diff = ( | ||
| (abs(imsg.linear_acceleration.x) - imu_accelerationx_avg) | ||
| / imu_accelerationx_avg | ||
| ) * 100 |
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.
Write DRY code!
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.
The IMU callback function is way too redundant, consider writing private methods to abstract the logic.
|
added private function, removed the statements to republish data. |

Monitoring node outputs to terminal when a spike has been detected. Only extremely large spikes will be detected, such as crashing into a wall. Below are some screenshots showing spikes.
Before spiking:
After crashing into wall:

After crashing into floor:
