Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Implementing Own Sendable (http://www.chiefdelphi.com/forums/showthread.php?t=136363)

rellimcire 04-04-2015 02:17

Implementing Own Sendable
 
1 Attachment(s)
Has anyone ever implemented their own Sendable object in Java and used with the Smartdashboard?

I have tried and failed miserably. The behavior I see when I try to use my implementation is that dashboard locks up and fails to receive any data. Restarting the dashboard and removing use of my class seems to fix the problem.

Attached is my SendablePosition class. A trival sample usage would the following in robotInit.
Code:

Smartdashboard.putData("test posit ", new SendablePosition(0,0));
A more useful example would be the following in teleopPeriodic.
Code:

Smartdashboard.putData("joystick posit ", new SendablePosition(driveStick.getX(), driveStick.getY()));
(where "driveStick" is the joystick controlling our drive)

Has anyone else seen this behavior? Has anyone else tried anything like this?

Ben Wolsieffer 04-04-2015 15:52

Re: Implementing Own Sendable
 
Have you created a Widget and type to view the position on the SmartDashboard? Without one, nothing should happen when you call "SmartDashboard.putData()", so I'm not sure why the SmartDashboard freezes.

We wrote a few Sendables for our robot, if you want to see examples:
WheelController
Robot Code (Sendable)
SmartDashboard Widget
SmartDashboard Type

ParameterCommand
Robot Code (Sendable)
SmartDashboard Widget
SmartDashboard Type

Let me know if you want explanations of how the code works.

rellimcire 05-04-2015 10:42

Re: Implementing Own Sendable
 
Thanks, very helpful. I missed entirely the need to create Smartdashboard widgets and types. Working my way through the docs and your code.


All times are GMT -5. The time now is 10:49.

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