|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
I have our robot done thanks to previous help with creating the class. I hope it works. I wasn't able to test it before we sent it off but we will find out on thrusday morning. What i need to get done now is creating the functions and applications that will pack the data, send the data, unpack the data and read the data. I am sure i can pack the data and send it based on reading the information provided by us first in packing the data. I need help on the other end...unpacking. I don't know how to read the eathernet port. I am going to use VB.net because i know that language. I know I need to use the imports functions before my class declearation, but i dont know what type of imports or how to unpack the data. Help please. we compete this thursday and although not necessary, i would like to have it up and running by then.
Thanks, ~Xtreamp~ |
|
#2
|
||||
|
||||
|
Re: sending/Reading the Eathernet port
You will probably want to use the System.Net.UdpClient class to receive data from the cRio.
Here is the receive code from my code: Code:
Sub BeginGetDataAsync() Implements IDashboardClient.BeginGetDataAsync
_listening = True
_client = New UdpClient(DS_TO_PC_LOCAL_PORT)
_client.BeginReceive(AddressOf Me.GetDataAsync, Nothing)
End Sub
Sub GetDataAsync(ByVal result As IAsyncResult) Implements IDashboardClient.GetDataAsync
Try
Dim endPoint As IPEndPoint = Nothing
Dim bytes = _client.EndReceive(result, endPoint)
ParseBytes(bytes)
Catch ex As Exception
Debug.WriteLine(ex.Message)
Debug.Assert(False)
Throw
Finally
If Listening Then
_client.BeginReceive(AddressOf Me.GetDataAsync, Nothing)
End If
End Try
End Sub
|
|
#3
|
||||
|
||||
|
Re: sending/Reading the Eathernet port
I downloaded the latest project that you uploaded but i wasn't able to get the crc32 or a few other folders/solutions to load. what am i missing.
|
|
#4
|
||||
|
||||
|
Re: sending/Reading the Eathernet port
Quote:
If there is anything else missing let me know. EDIT: I confirmed I can compile a clean checkout on another machine. If you have issues all of the non-source-included dependencies are in the .\src\libs folder. Last edited by EHaskins : 17-03-2009 at 23:04. |
|
#5
|
||||
|
||||
|
Re: sending/Reading the Eathernet port
Here is some code I just wrote. I haven't tested it, but it should display any printed or error strings which are written to the dashboard from the robot.
I've committed this to the Codeplex repo if you want the project file. Hopefully you find it useful. Code:
Imports EHaskins.Frc.Dashboard
Module Module1
Sub Main()
Dim dashboard As New DashboardClient(Of DefaultUserDataProcessor)
dashboard.BeginUpdating()
Dim lastIndex As Integer
Dim printedLength As Integer
Dim errorLength As Integer
Do
Dim data = dashboard.UserData
If data IsNot Nothing AndAlso _
Not lastIndex = data.PacketNumber Then
'Write new printed strings
If data.PrintedStrings.Count > printedLength Then
For i = printedLength To data.PrintedStrings.Count() - 1
Console.WriteLine(data.PrintedStrings(i))
Next
printedLength = data.PrintedStrings.Count()
End If
'Write new error strings
If data.ErrorStrings.Count > errorLength Then
For i = errorLength To data.ErrorStrings.Count() - 1
Dim oldColor = Console.ForegroundColor
Console.ForegroundColor = ConsoleColor.Red
Console.WriteLine(data.ErrorStrings(i))
Console.ForegroundColor = oldColor
Next
errorLength = data.ErrorStrings.Count()
End If
End If
Threading.Thread.Sleep(10) 'Give the CPU a break. :)
Loop
End Sub
End Module
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| paper: Reading the FTC Battery Voltage | PhilBot | Extra Discussion | 4 | 16-01-2009 08:46 |
| COM Port data reading without dashboard | 3DWolf | Programming | 14 | 14-04-2008 00:17 |
| Does reading from the serial port work? | Alan Anderson | Programming | 16 | 29-01-2008 07:15 |
| sending extra information to the OI | iwdu15 | Programming | 2 | 06-02-2007 20:05 |
| Sending data back to the OI | DanDon | Programming | 13 | 26-01-2006 15:17 |