Go to Post I believe with every fiber of my being that Engineering is an Art. It is a beautiful, wonderful, delightful art. - Joe Johnson [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 17-03-2009, 19:15
xtreampb's Avatar
xtreampb xtreampb is offline
Lead Programmer 2642
FRC #2642 (Pitt Pirates)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2009
Location: Snow Hill
Posts: 21
xtreampb is an unknown quantity at this point
Send a message via AIM to xtreampb Send a message via Yahoo to xtreampb
Exclamation sending/Reading the Eathernet port

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~
__________________
~Xtreampb~

Pitt Pirates 2642

Lead Programmer
  #2   Spotlight this post!  
Unread 17-03-2009, 22:27
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
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
If you need more info you can ask me, or take a look at my dashboard viewer.
__________________
Eric Haskins KC9JVH
  #3   Spotlight this post!  
Unread 17-03-2009, 22:54
xtreampb's Avatar
xtreampb xtreampb is offline
Lead Programmer 2642
FRC #2642 (Pitt Pirates)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2009
Location: Snow Hill
Posts: 21
xtreampb is an unknown quantity at this point
Send a message via AIM to xtreampb Send a message via Yahoo to xtreampb
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.
__________________
~Xtreampb~

Pitt Pirates 2642

Lead Programmer
  #4   Spotlight this post!  
Unread 17-03-2009, 22:59
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: sending/Reading the Eathernet port

Quote:
Originally Posted by xtreampb View Post
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.
crc32 is a C# project. If you don't have VS Pro or above it won't load. I've attached the complied DLL. Remove the crc32 project by right-clicking it, selecting Remove. Then in EHaskins.Frc.Dashboard, add a reference to the crc32.dll I attached.

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.
Attached Files
File Type: zip Crc32.zip (4.5 KB, 45 views)
__________________
Eric Haskins KC9JVH

Last edited by EHaskins : 17-03-2009 at 23:04.
  #5   Spotlight this post!  
Unread 17-03-2009, 23:22
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
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
__________________
Eric Haskins KC9JVH
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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


All times are GMT -5. The time now is 02:01.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi