Log in

View Full Version : Implementing Own Sendable


rellimcire
04-04-2015, 02:17
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.
Smartdashboard.putData("test posit ", new SendablePosition(0,0));

A more useful example would be the following in teleopPeriodic.
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
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) (https://github.com/RobotsByTheC/CMonster2015/blob/master/src/org/usfirst/frc/team2084/CMonster2015/drive/WheelController.java)
SmartDashboard Widget (https://github.com/RobotsByTheC/SmartDashboardExtensions2015/blob/master/src/org/usfirst/frc/team2084/smartdashboard/extensions/WheelControllerDisplay.java)
SmartDashboard Type (https://github.com/RobotsByTheC/SmartDashboardExtensions2015/blob/master/src/org/usfirst/frc/team2084/smartdashboard/extensions/WheelControllerType.java)

ParameterCommand
Robot Code (Sendable) (https://github.com/RobotsByTheC/CMonster2015/blob/master/src/org/usfirst/frc/team2084/CMonster2015/commands/ParameterCommand.java)
SmartDashboard Widget (https://github.com/RobotsByTheC/SmartDashboardExtensions2015/blob/master/src/org/usfirst/frc/team2084/smartdashboard/extensions/ParameterCommand.java)
SmartDashboard Type (https://github.com/RobotsByTheC/SmartDashboardExtensions2015/blob/master/src/org/usfirst/frc/team2084/smartdashboard/extensions/ParameterCommandType.java)

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

rellimcire
05-04-2015, 10:42
Thanks, very helpful. I missed entirely the need to create Smartdashboard widgets and types. Working my way through the docs and your code.