Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New command framework for C++ #248

Merged

Conversation

cbennet
Copy link
Contributor

@cbennet cbennet commented Aug 12, 2020

This updates RobotBuilder to create the new c++ commands. Some cleanup and formatting is still required.

@sciencewhiz sciencewhiz linked an issue Aug 15, 2020 that may be closed by this pull request
Copy link
Collaborator

@sciencewhiz sciencewhiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a command does not require a subsystem, the value "None" is used in the export, which doesn't compile. The templates need to check if the subsystem is None.

For example in the .h
#include "Subsystems/None.h"
explicit AutonomousCommand(None* none);

in the .cpp:
AutonomousCommand::AutonomousCommand(None* none) :m_none(none){
AddRequirements({m_none});

src/main/resources/export/cpp/Command.h Outdated Show resolved Hide resolved
src/main/resources/export/cpp/Command.h Outdated Show resolved Hide resolved
src/main/resources/export/cpp/Command.cpp Outdated Show resolved Hide resolved
Update Robot.c/h with new command template
Export OI includes in RobotContainer to Commands get Included
Fix RunsWhenDisabled in Command
@sciencewhiz sciencewhiz changed the title New command framework New command framework for C++ Aug 18, 2020
@sciencewhiz
Copy link
Collaborator

This is the file I'm using to test
robotbuilder-test-save6845451186554322753-339787238534500.yml.txt

@sciencewhiz
Copy link
Collaborator

I still get some compile errors when I build with the project posted above.

@sciencewhiz
Copy link
Collaborator

I've fixed several issues over the weekend. Two more I've found are that commands that don't require a subsystem don't export correctly in RobotContainer JoystickButtons, they subsystem export with &m_none instead of blank. Also, parameters don't export correctly.

@sciencewhiz
Copy link
Collaborator

Comments from @prateekma:

The examples on the allwpilib repo use lowercase folder names for subsystems, commands, etc.
Inconsistent usage of <> and "" for includes (project includes should use quotation marks, WPILib includes should use angular brackets).
Constants in subsystems can be static constexpr to avoid having to define them in the source.
use of tabs in some places and needs indentation fixes

@sciencewhiz
Copy link
Collaborator

Need to standardize on the template names with Java and remove OI

@sciencewhiz sciencewhiz merged commit 50f5d53 into wpilibsuite:NewCommandFramework Oct 18, 2020
@sciencewhiz sciencewhiz added this to Done in 2021 Oct 18, 2020
sciencewhiz added a commit to Beachbot330/RobotBuilder that referenced this pull request Oct 25, 2020
Update to export New Command Framework. Fixes wpilibsuite#191
Use uniform initialization in header. Fixes wpilibsuite#80

Co-authored-by: Joe <sciencewhiz@users.noreply.github.com>
sciencewhiz added a commit that referenced this pull request Oct 25, 2020
Update to export New Command Framework. Fixes #191
Use uniform initialization in header. Fixes #80

Co-authored-by: Joe <sciencewhiz@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
2021
  
Done
Development

Successfully merging this pull request may close these issues.

Implement C++ New Commands Remove C++ smart pointers in favor of uniform initialization syntax in header
2 participants