diff --git a/mission/internal_status/README.md b/mission/internal_status/README.md new file mode 100644 index 00000000..491c159d --- /dev/null +++ b/mission/internal_status/README.md @@ -0,0 +1,22 @@ +# Internal Status + +This package contains a library which allows us to get current and voltage values from the Power Sense Module (PSM), and a ros node which publishes this data to the whole ROS environment. + +## PSM lib + +The ASV as a PSM. It takes voltage and current data going into internal electrical instruments on board. This library is a driver, which allows us to get the voltage (in V) and current (in A) values from PSM through I2C. +The I2C address is 0X69. +* Typical values for voltage: around 21V +* Typical values for current: around 0.6A + + +## PSM node + +This ros node just publishes the current and voltage data we get from the lib to the entire ROS environment. +### Publishes to +* /asv/power_sense_module/current for the current data [A] +* /asv/power_sense_module/voltage for the voltage data [V] + + + + diff --git a/mission/internal_status/internal_status/power_sense_module_lib.py b/mission/internal_status/internal_status/power_sense_module_lib.py index aaa2fe3a..e128a02f 100644 --- a/mission/internal_status/internal_status/power_sense_module_lib.py +++ b/mission/internal_status/internal_status/power_sense_module_lib.py @@ -19,7 +19,7 @@ def __init__(self): self.i2c_adress, channel=0, resolution=18) # current - #time.sleep(1) + # Convertion ratios taken from PSM datasheet at: https://bluerobotics.com/store/comm-control-power/control/psm-asm-r2-rp/ self.psm_to_battery_voltage = 11.0 # V/V diff --git a/mission/internal_status/internal_status/power_sense_module_publisher.py b/mission/internal_status/internal_status/power_sense_module_publisher.py index 53a442e7..87ec8980 100644 --- a/mission/internal_status/internal_status/power_sense_module_publisher.py +++ b/mission/internal_status/internal_status/power_sense_module_publisher.py @@ -14,7 +14,7 @@ def __init__(self): self.publisher_voltage = self.create_publisher(Float32, '/asv/power_sense_module/voltage', 1) timer_period = 0.5 self.timer = self.create_timer(timer_period, self.timer_callback) - self.i = 0 + def timer_callback(self): current = Float32() @@ -26,7 +26,6 @@ def timer_callback(self): self.get_logger().info('Publishing PSM current: "%s"' % current.data) self.publisher_voltage.publish(voltage) #publish voltage value to the "voltge topic" self.get_logger().info('Publishing PSM voltage: "%s"' % voltage.data) - self.i += 1 def main(args=None):