Still unable to properly set the GPS rate higher. Code should be working, but it seems like maybe things aren't being sent through the Etherbotix correctly?
Current code that I've been working with (the switch to 57600 baud seems to be working, but not the other commands).
diff --git a/nodes/gps_publisher.py b/nodes/gps_publisher.py
index 74569aa..7131c56 100755
--- a/nodes/gps_publisher.py
+++ b/nodes/gps_publisher.py
@@ -34,6 +34,10 @@ import rospy
from nmea_msgs.msg import Sentence
from etherbotix_python.etherbotix import *
+PMTK_SET_NMEA_UPDATE_5HZ = "$PMTK220,200*2C\r\n"
+PMTK_SET_BAUD_57600 = "$PMTK251,57600*2C\r\n"
+PMTK_SET_FIX_RATE_5HZ = "$PMTK300,200,0,0,0,0*2F\r\n"
+
## @brief This is a simple wrapper that connects to the Etherbotix,
## sets up USART3 to forward packets that are '\n' terminated,
## and publishes those packets as GPS sentences.
@@ -47,6 +51,15 @@ class GPSPublisher(Etherbotix):
def setup(self):
# Set baud to 9600, set terminating character to '\n' (10)
self.write(253, self.P_USART_BAUD, [207, 10])
+ # Switch baud to 57600
+ self.nmea_command(PMTK_SET_BAUD_57600)
+ self.write(253, self.P_USART_BAUD, [34, 10])
+ self.nmea_command(PMTK_SET_FIX_RATE_5HZ)
+ self.nmea_command(PMTK_SET_NMEA_UPDATE_5HZ)
+
+ def nmea_command(self, cmd):
+ cmd = [ord(x) for x in cmd]
+ self.write(253, self.P_DEVICE_USART3_DATA, cmd)
def run(self):
self.setup()
@@ -58,6 +71,7 @@ class GPSPublisher(Etherbotix):
s.header.stamp = rospy.Time.now()
s.sentence = packet.params.rstrip()
self.publisher.publish(s)
+ print(s.sentence)
if __name__=="__main__":
rospy.init_node("gps_publisher")
Still unable to properly set the GPS rate higher. Code should be working, but it seems like maybe things aren't being sent through the Etherbotix correctly?
Current code that I've been working with (the switch to 57600 baud seems to be working, but not the other commands).