You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a simple code that I wrote on ubuntu 20.04. my goal is to connect to QGC and to see "Ready to fly" in the main screen.
my ip in the computer that qgc works on is 192.168.168.95 and my device ip is 192.168.168.5, when I run my device I can see in wireshark that there is communication between my device and qgc but still on the main screen it says "Disconnected"
this is my code on the device:
import rclpy
from rclpy.node import Node
from pymavlink import mavutil
class QGCcommNode(Node):
def init(self):
super().init("qgc_comm")
# Connect to the MAVLink instance
self.master = mavutil.mavlink_connection('udpout:192.168.168.95:14570', source_system =1,source_component=1 )
self.the_connection = mavutil.mavlink_connection('udpin:192.168.168.5:14575')
self.timer = self.create_timer(1, self.send_heartbeat)
# Function to send a heartbeat message
def send_heartbeat(self):
try:
self.master.mav.heartbeat_send(
type=mavutil.mavlink.MAV_TYPE_GENERIC,
autopilot=mavutil.mavlink.MAV_AUTOPILOT_GENERIC,
base_mode=0,
custom_mode=0,
system_status=mavutil.mavlink.MAV_STATE_ACTIVE
)
# Wait for a heartbeat
msg = self.the_connection.recv_match(type='HEARTBEAT', blocking=True, timeout=1)
if msg:
self.get_logger().info("Heartbeat received from system")
else:
self.get_logger().warning("No heartbeat received")
except Exception as e:
self.get_logger().error(f"Error in send_heartbeat1: {str(e)}")
when I run this code I get the "Heartbeat received from system" but yet the qgc is not connecting. in addition when I enter the Analyze Tools --> Mavlink Inspector this is the message that the qgc sends:
I would love if someone wil help me :)
The text was updated successfully, but these errors were encountered:
I have a simple code that I wrote on ubuntu 20.04. my goal is to connect to QGC and to see "Ready to fly" in the main screen.
my ip in the computer that qgc works on is 192.168.168.95 and my device ip is 192.168.168.5, when I run my device I can see in wireshark that there is communication between my device and qgc but still on the main screen it says "Disconnected"
this is my code on the device:
import rclpy
from rclpy.node import Node
from pymavlink import mavutil
class QGCcommNode(Node):
def init(self):
super().init("qgc_comm")
# Connect to the MAVLink instance
self.master = mavutil.mavlink_connection('udpout:192.168.168.95:14570', source_system =1,source_component=1 )
self.the_connection = mavutil.mavlink_connection('udpin:192.168.168.5:14575')
self.timer = self.create_timer(1, self.send_heartbeat)
def main(args=None):
when I run this code I get the "Heartbeat received from system" but yet the qgc is not connecting. in addition when I enter the Analyze Tools --> Mavlink Inspector this is the message that the qgc sends:
I would love if someone wil help me :)
The text was updated successfully, but these errors were encountered: