Skip to content

Commit

Permalink
More clarity on dispensing state (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermedemouraa authored Jul 2, 2024
1 parent fd5f893 commit 3f497e4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions protos/farm_ng/canbus/tool_control.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ enum PtoCommandType {
// Enum for commanding BugDispenser device state
enum BugDispenserState {
BUG_DISPENSER_UNKNOW = 0; // Default value indicating unknown state
BUG_DISPENSER_ACTIVE = 1; // Activate the bug dispenser
BUG_DISPENSER_STOPPED = 2; // Stop the bug dispenser
BUG_DISPENSER_ACTIVE = 1; // The bug dispenser is active
BUG_DISPENSER_STOPPED = 2; // The bug dispenser is stopped
}

// Tool command replies, decoded from AmigaTpdo1 CAN messages
Expand Down Expand Up @@ -81,9 +81,9 @@ message PtoCommand {

// For commanding a BugDispenser device
message BugDispenserCommand {
uint32 id = 1; // Bug dispenser ID (e.g., 0x0 - 0x2)
uint32 id = 1; // Bug dispenser ID (e.g., 0x20 - 0x22)
float rate = 2; // Dispensing rate in meters between drops
BugDispenserState state = 3; // Dispensing state
BugDispenserState state = 3; // Bug dispenser state (UNKNOWN, ACTIVE, STOPPED)
}


Expand Down Expand Up @@ -139,11 +139,11 @@ message PtoStatus {
// Message to receive bug dispenser status
message BugDispenserStatus {
double stamp = 1; // Stamp of the bug dispenser RawCanbusMessage event
uint32 id = 2; // Bug dispenser ID (e.g., 0x0 - 0x2)
BugDispenserState state = 3; // UNKNOWN, STOPPED, ACTIVE
uint32 id = 2; // Bug dispenser ID (e.g., 0x20 - 0x22)
BugDispenserState state = 3; // UNKNOWN, ACTIVE, STOPPED
float rate = 4; // Dispensing rate in meters between drops
bool bug_dispenser_empty = 5; // Whether the hopper is empty
float volume_dispensed = 6; // Volume of product dispensed
bool bug_dispenser_is_dispensing = 5; // Whether the hopper is dispensing
float volume_dispensed = 6; // Volume of product dispensed in liters
}


Expand Down
4 changes: 2 additions & 2 deletions py/farm_ng/canbus/packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ def decode(self, data):

def __str__(self):
"""Returns a string representation of the class."""
return f"BugDispenserRpdo1: Rates: {self.rate0}, {self.rate1}, {self.rate2}"
return f"BugDispenserCommand: Rates: {self.rate0}, {self.rate1}, {self.rate2}"

def to_raw_canbus_message(self) -> canbus_pb2.RawCanbusMessage:
"""Packs the class data into a canbus_pb2.RawCanbusMessage."""
Expand Down Expand Up @@ -598,6 +598,6 @@ def from_raw_canbus_message(cls, message: canbus_pb2.RawCanbusMessage) -> BugDis
def __str__(self):
"""Returns a string representation of the class."""
return (
f"BugDispenserTpdo1: Rates: {self.rate0}, {self.rate1}, {self.rate2} "
f"BugDispenserState: Rates: {self.rate0}, {self.rate1}, {self.rate2} "
f"| Counters: {self.counter0}, {self.counter1}, {self.counter2}"
)

0 comments on commit 3f497e4

Please sign in to comment.