![]() |
TCP communication with cRIO
I've been trying to get TCP connections working with the cRIO. I have an Android app and robot code setup. I've gotten them to connect to each other, but every time I spawn a process it crashes the whole thing. This is my code, is there any options that I'm getting wrong?
App code: Code:
public class BotSmithsAppActivity extends Activity Code:
VOID tcpServerWorkTask(int sFd, char* address, u_short port); |
Re: TCP communication with cRIO
I'm not sure exactly what is wrong but I think you need a different architecture for your tcp server code on the robot. We were able to get things working using the examples on this website:
http://beej.us/guide/bgnet/ In particular, our "server" code uses 'select' to see if any of the clients have anything to say. We can then "poll" rather than putting our robot code inside of an infinite loop like you're having to do. This page has some information on using 'select': http://beej.us/guide/bgnet/output/ht...ed.html#select Using this, our server code was all inside a function call rather than the other way around and we didn't have to spawn any tasks. Hope this helps! |
Re: TCP communication with cRIO
The VxWorks taskSpawn command has great flexibility, but on the down-side, it gives you plenty power to shoot yourself in the foot.
I looked up the error code and didn't quite find it. http://www.vxdev.com/docs/vx55man/vx...noNumList.html has memlib errors that go up to 1114117, but no ...8. All of those are related to a bad pointer or access to memory you aren't supposed to access. I don't have vxworks dev tools at home. Try searching for the error code. I suspect you'll find it in the memlib header file and it will give a hint as to the issue. Meanwhile, the easiest problems to have with spawning a task are to make the stack too small or to leave floating point registers out of the stack frame which will lead to a corruption once you accidentally use floats. Try adding a zero to the stack size and reviewing all of the other jillion parameters to spawn to see if any of them sound necessary. Greg McKaskle |
Re: TCP communication with cRIO
Okay, I'll test that out when I can actually access the robot.
|
Re: TCP communication with cRIO
I'm certainly not an expert when it comes to TCP packets and IP addresses as the such... But if your team number is 4309 shouldn't your ip address in the code be 10.43.09.2?? I believe you are representing yourself in the code as team 439. I'm probably wrong but that is my guess!
Quote:
|
Re: TCP communication with cRIO
I can connect just fine using that ip address with everything else. But you might be right, I'll change it and see what happens. I've been able to spawn tasks, they just crash.
|
Re: TCP communication with cRIO
Quote:
009 or 09 or 9 are all identical numbers. The .9. translates into a bit pattern padded with leading zeros to fill out the field. Adding more leading zeros has no effect. |
Re: TCP communication with cRIO
Quote:
|
Re: TCP communication with cRIO
Quote:
Team 439: 10.4.39.X Team 4309: 10.43.9.X Team 4390: 10.43.90.X |
Re: TCP communication with cRIO
I have code that we used last year to have the driverstation send data to the crio. It spawns a task, and while it wasn't used to move the robot, it may help with what you are trying to do.
I'll post it when I get home. It is udp, not tcp because I didn't think we need the over head for what we were doing, and could afford to lose messages if need be. And it's not really robust but ... |
Re: TCP communication with cRIO
Here's the code that we used. Worked fine for what we needed, and hopefully helps you.
Code:
#include "WPILib.h" |
| All times are GMT -5. The time now is 00:50. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi