❌ About FreshRSS

Reading view

There are new articles available, click to refresh the page.

Mavlink Ada - Having issues while connecting using UDP

The examples (https://github.com/ArduPilot/pymavlink/tree/master/generator/Ada/examples) are implemented using Serial communication. When I tried to update one of the examples with UDP protocol, Mav_Conn.Parse_Byte() is not returning true (But I'm receiving the data). I'm not sure, what I've done wrong, Can someone help me with this?

Also, adding the code for your reference, Thank you:

with Ada.Streams; with Ada.Text_IO; with Interfaces; with Ada.Numerics.Generic_Elementary_Functions; with GNAT.Sockets; use GNAT.Sockets; with Ada.Unchecked_Conversion; with Mavlink; with Mavlink.Connection; with Mavlink.Messages; with Mavlink.Types; procedure Attitude is use type Ada.Streams.Stream_Element_Offset; use type Interfaces.Unsigned_8; package Short_Float_Text_IO is new Ada.Text_IO.Float_IO(Short_Float); Server : Socket_Type; Address, From : Sock_Addr_Type; Input : Ada.Streams.Stream_Element_Array(1..1024); Input_Last : Ada.Streams.Stream_Element_Offset; Count : Integer := 0; Mav_Conn : Mavlink.Connection.Connection (System_Id => 250); procedure Handler_Attitude is Attitude : Mavlink.Messages.Attitude; K_Rad2Deg : Short_Float := 180.0 / Ada.Numerics.Pi; begin Mav_Conn.Unpack (Attitude); Ada.Text_IO.Put ("Pitch: "); Short_Float_Text_IO.Put(Attitude.Pitch * K_Rad2Deg, Aft => 4, Exp => 0); Ada.Text_IO.Put (" Roll: "); Short_Float_Text_IO.Put(Attitude.Roll * K_Rad2Deg, Aft => 4, Exp => 0); Ada.Text_IO.Put (" Yaw: "); Short_Float_Text_IO.Put(Attitude.Yaw * K_Rad2Deg, Aft => 4, Exp => 0); Ada.Text_IO.New_Line; end Handler_Attitude; begin Create_Socket (Server, Family_Inet, Socket_Datagram); Set_Socket_Option (Server, Socket_Level, (Reuse_Address, True)); Address.Addr := Inet_Addr("127.0.0.1"); Address.Port := 14551; Ada.Text_IO.Put_Line ("Connects to ardupilot (baud rate 115200) via ttyUSB0 and reads attitude angles"); Bind_Socket (Server, Address); loop Receive_Socket (Server, Input, Input_Last, From); for B of Input (Input'First .. Input_Last) loop if Mav_Conn.Parse_Byte(Interfaces.Unsigned_8(B)) then if Mav_Conn.Get_Msg_Id = Mavlink.Messages.Attitude_Id then Handler_Attitude; end if; end if; end loop; end loop; end Attitude; 
submitted by /u/technicalvillager
[link] [comments]

Issues while connecting NeoPixel (WS2812B) LED strips with Raspberry Pi Pico

I'm having issues connecting the WS2812B with Raspberry Pi Pico. I'm trying to execute the example program https://github.com/JeremyGrosser/pico_examples/blob/master/ws2812_demo/src/main.adb

But after loading this executable only the inbuilt LED is blinking. I do not have any logic analyzers to check the output, but the data output is in the range of 1.7v to 2v. So I've connected a 3.3v to 5v level shifter but still no response in the strip. But the strip is working fine with micro-python.

Has anyone tried using the WS2812B strip with pico? I'm currently not sure what I've missed.

submitted by /u/technicalvillager
[link] [comments]
❌