|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Robotbuilder c++ code dies in Test Mode
Finally got example robot programs to run after Plugin update. Thanx.
Now I tried the most simple RobotBuilder C++ code (one subsystem with one speed controller). exported, imported, built and deployed OK. When I select Test Mode then enable. The Drivers Station indicates Test Enabled for 1/2 second, then Test Disabled. The roborio Mode indicator goes Red, then Comm indicator Red, then Mode goes off and Comm goes back to green. |
|
#2
|
||||||
|
||||||
|
Re: Robotbuilder c++ code dies in Test Mode
I've duplicated this. It has to do with the way the SpeedController object is cast to the
Here's the code that causes the crash: Code:
lw->AddActuator("Subsystem 1", "Speed Controller 1", (Talon&)subsystem1SpeedController1);
Code:
lw->AddActuator("Subsystem 1", "Speed Controller 1", std::static_pointer_cast<Talon>(subsystem1SpeedController1));
|
|
#3
|
||||
|
||||
|
Re: Robotbuilder c++ code dies in Test Mode
Quote:
Is subsystem1SpeedController1 an object or pointer to an object? If the suggested code is correct, then subsystem1SpeedController1 is a pointer and casting to Talon& seems strange to me anyway. |
|
#4
|
||||||
|
||||||
|
Re: Robotbuilder c++ code dies in Test Mode
Quote:
Code:
#include "RobotMap.h"
#include "LiveWindow/LiveWindow.h"
std::shared_ptr<SpeedController> RobotMap::subsystem1SpeedController1;
void RobotMap::init() {
LiveWindow *lw = LiveWindow::GetInstance();
subsystem1SpeedController1.reset(new Talon(0));
lw->AddActuator("Subsystem 1", "Speed Controller 1", (Talon&) subsystem1SpeedController1);
}
Last edited by Joe Ross : 18-01-2016 at 00:10. |
|
#5
|
|||
|
|||
|
Re: Robotbuilder c++ code dies in Test Mode
Thanks, that worked for me.
|
|
#6
|
||||||
|
||||||
|
I submitted a patch for review for this for Robot Builder.
|
|
#7
|
|||
|
|||
|
Re: Robotbuilder c++ code dies in Test Mode
How do I find out when or if Robot Builder gets revised?
|
|
#8
|
||||||
|
||||||
|
Re: Robotbuilder c++ code dies in Test Mode
New software releases are mentioned in team updates, or you can watch one of these pages on screensteps: http://wpilib.screenstepslive.com/s/...ware-revisions or http://wpilib.screenstepslive.com/s/...ugin-changelog
|
|
#9
|
||||||
|
||||||
|
Re: Robotbuilder c++ code dies in Test Mode
I think there's an eminent release of the eclipse plugins including robot builder with this fix. However, in the meantime, here's a version with the fix.
Edit: see version below. Last edited by Joe Ross : 25-01-2016 at 00:49. |
|
#10
|
|||
|
|||
|
Re: Robotbuilder c++ code dies in Test Mode
Did a quick test and it works. Thanx a lot...
|
|
#11
|
|||
|
|||
|
Re: Robotbuilder c++ code dies in Test Mode
Still have problem with the most simple c++ program built with new Robot Builder (one generic subsystem with one motor actuator).
old robot builder std::shared_ptr<SpeedController> RobotMap::subsystem1SpeedController1; // <<< this is ok lw->AddActuator("Subsystem 1", "Speed Controller 1", (Talon&) subsystem1SpeedController1); // <<< this caused Test Mode to abort new robot builder static std::shared_ptr<SpeedController> subsystem1SpeedController1; // <<< this causes a build error lw->AddActuator("Subsystem 1", "Speed Controller 1", std::static_pointer_cast<Talon>(subsystem1SpeedCon troller1)); // <<< this is OK |
|
#12
|
||||||
|
||||||
|
Re: Robotbuilder c++ code dies in Test Mode
Try this version
|
|
#13
|
|||
|
|||
|
Re: Robotbuilder c++ code dies in Test Mode
Looks right. I will test on robot this afternoon.
Thanx |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|