Closed TzionCastillo1 closed 2 years ago
Any help would be appreciated!
Hi @TzionCastillo1,
Sorry for the delay, did you manage to solve this? A first step could be to debug the failure point on the code, this could give us some insight on the problem.
I have not yet. It seems to be failing during the execution of the subscription_callback function. I added in a buzzer to help debug, and the buzzer stops producing the tone before the noTone() function tells it to do so. My first instinct after this is that the board is crashing, but the Portenta H7 I am using has a built in function to flash the onboard red LED, and this is not happening.
updated subscription_callback function for debugging
//twist message cb
void subscription_callback(const void *msgin) {
tone(BUZZER, 5000);
const geometry_msgs__msg__Twist * twstmsg = (const geometry_msgs__msg__Twist *)msgin;
// if velocity in x direction is 0 turn off LED, if 1 turn on LED
//digitalWrite(LED_PIN, (twstmsg->linear.x == 0) ? LOW : HIGH);
int ESCpwmVal = map((twstmsg->linear.x)*100, -100, 100, 1100, 1900);
int SRVOpwmVal = map((twstmsg->angular.z)*-100, -300, 300, 1170, 1830);
ESC.writeMicroseconds(ESCpwmVal);
SRVO.writeMicroseconds(SRVOpwmVal);
delay(1000);
noTone(BUZZER);
}
EDIT:
Looking deeper into this, the amount of time this function is executed for is very strongly correlated with the update rate of the GPS. If I set the gps to send updates every second, the code executes for ~2 seconds. If i set the update rate to once every 5 seconds, the code executes for ~10 seconds, if I set the update rate to once every 10 seconds, the code executes for ~30s. I'm guessing this has something to to with the interrupts coming from the GPS, but I'm not sure where I'd start to fix that.
You can execute the agent in debug mode using the flag -v6
, this way we can see if the board is still trying to communicate with the agent.
You can also take a look inside the GPS library to see what its doing, but I am afraid we cannot replicate this issue.
Any update on this?
Nothing useful. I looked through the Adafruit GPS library and I did not see anything that would interfere with the microros library. I ended up connecting another Arduino to the Portenta's UART port, and had it just send a char, but the same issue persists. I also tired this on the other Serial ports using the Portenta Breakout Board. Outside of this, I'm not really sure where I'd begin to look to fix this bug. I understand this can't be replicated, but if there are recommendations I'd be more than happy to try them out.
Closing as we cannot replicate this, please reopen if needed or on new information on this bug.
Issue template
Steps to reproduce the issue
Expected behavior
Both "/gps" and "/Imu" publish, and motor and servo move in response to "/twist" topic.
Actual behavior
All of the topics, subscribers, and publishers are created with the agent. "/gps" and "/Imu" topics are published to twice, as well as the motor & servo respond to the "/twist" topic messages for a few seconds. Everything becomes unresponsive after this.
Additional information
All of the subscriptions and publishers work as expected when isolated, as well as any combination of two of the three, but when I have all three run together I run into this issue.
Any help would be much appreciated.
EDIT
If I comment out the lines to initialize communication with the GPS:
all topics publish, but the "/gps" topic of course publishes a blank message. The GPS is on a UART port separate from the one connected to the USB on the Portenta, so I'm not sure if this issue is UART related. Also I am able to initialize the GPS and publish readings from it just fine when it is in isolation, or when it is paired with one other publisher or subscriber. Really lost with what could be wrong here.