|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||||
|
||||||
|
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));
|
|
#2
|
||||
|
||||
|
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. |
|
#3
|
||||||
|
||||||
|
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. |
|
#4
|
|||
|
|||
|
Re: Robotbuilder c++ code dies in Test Mode
Thanks, that worked for me.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|