View Single Post
  #7   Spotlight this post!  
Unread 16-01-2014, 07:00
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: Processed Image > Robot Movement Help Needed

Part 3 of the tutorial, step 5, shows a picture of flattening and sending the string via network tables.

To compare the choices:
1. Unbundle and write individual elements using network tables/smart dashboard:
a. This may be the simplest to approach.
b. You will be restricted to the types supported by network tables.
c. It is possible that the elements do not arrive at the same time. If you write ten elements, five may be delivered now and the other five in 100ms.
2. Flatten the cluster and write it using SD/NT.
a. This is similarly simple, but involves flattening and unflattening data.
b. You must match the types exactly. An int and a float aren't the same, and order matters.
3. Format or flatten to a string and write using TCP.
a. This is still not hard, but you need to use the TCP nodes in addition to flattening or string formatting functions. You also need to unflatten or parse the string on the other end.
b. You need to specify the correct port that will be opened on a official field.
c. This is how NT/SD works under the hood.
4. Format or flatten and write using UDP.
a. Similar to TCP, but some find UDP easier to understand.
b. UDP isn't guaranteed to arrive, though for repetitive writes, you can typically ignore this.
c. Be sure to use the correct ports for UDP, not the TCP ones.

Once the data is sent, you need to read it on the robot. You can put the SD/NT reads almost anywhere, but I'd suggest Periodic tasks. TCP and UDP should really go there and not in auto or tele code. Once you have it in periodic, reform your cluster and write it to a global. Read the global in auto or tele.

Greg McKaskle
Reply With Quote