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.
Followed the comments I made previously
mohana-pamidi
left a comment
There was a problem hiding this comment.
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.
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) |
| # create running average for relevant measurements: | ||
| # acceleration x |
There was a problem hiding this comment.
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.
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:
