Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions commandsv2/generate_hids.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def generate_hids(output_directory: Path, template_directory: Path, schema_file:
controllers = json.load(f)

# Java files
java_subdirectory = "main/java/org/wpilib/command2/button"
java_subdirectory = "main/java/org/wpilib/command2/button/nids"
env = Environment(
loader=FileSystemLoader(template_directory / "main/java"),
autoescape=False,
Expand All @@ -36,7 +36,7 @@ def generate_hids(output_directory: Path, template_directory: Path, schema_file:
write_controller_file(root_path, controllerName, output)

# C++ headers
hdr_subdirectory = "main/native/include/wpi/commands2/button"
hdr_subdirectory = "main/native/include/wpi/commands2/button/nids"
env = Environment(
loader=FileSystemLoader(template_directory / hdr_subdirectory),
autoescape=False,
Expand All @@ -50,7 +50,7 @@ def generate_hids(output_directory: Path, template_directory: Path, schema_file:
write_controller_file(root_path, controllerName, output)

# C++ files
cpp_subdirectory = "main/native/cpp/wpi/commands2/button"
cpp_subdirectory = "main/native/cpp/wpi/commands2/button/nids"
env = Environment(
loader=FileSystemLoader(template_directory / cpp_subdirectory),
autoescape=False,
Expand Down
6 changes: 4 additions & 2 deletions commandsv2/src/generate/main/java/commandhid.java.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
{% macro capitalize_first(string) -%}
{{ string[0]|capitalize + string[1:] }}
{%- endmacro %}
package org.wpilib.command2.button;
package org.wpilib.command2.button.nids;

import org.wpilib.command2.CommandScheduler;
import org.wpilib.driverstation.{{ ConsoleName }}Controller;
import org.wpilib.command2.button.CommandGenericHID;
import org.wpilib.command2.button.Trigger;
import org.wpilib.driverstation.nids.{{ ConsoleName }}Controller;
import org.wpilib.event.EventLoop;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@
{% macro capitalize_first(string) -%}
{{ string[0]|capitalize + string[1:] }}
{%- endmacro %}
#include "wpi/commands2/button/Command{{ ConsoleName }}Controller.hpp"
#include "wpi/commands2/button/nids/Command{{ ConsoleName }}Controller.hpp"

using namespace wpi::cmd;
using namespace wpi::cmd::nids;

Command{{ ConsoleName }}Controller::Command{{ ConsoleName }}Controller(int port)
: CommandGenericHID(port), m_hid{wpi::{{ ConsoleName }}Controller(port)} {}
: CommandGenericHID(port), m_hid{wpi::nids::{{ ConsoleName }}Controller(port)} {}

wpi::{{ ConsoleName }}Controller& Command{{ ConsoleName }}Controller::GetHID() {
wpi::nids::{{ ConsoleName }}Controller& Command{{ ConsoleName }}Controller::GetHID() {
return m_hid;
}
{% for button in buttons %}
Trigger Command{{ ConsoleName }}Controller::{{ capitalize_first(button.name) }}(wpi::EventLoop* loop) const {
return Button(wpi::{{ ConsoleName }}Controller::Button::k{{ capitalize_first(button.name) }}, loop);
return Button(wpi::nids::{{ ConsoleName }}Controller::Button::k{{ capitalize_first(button.name) }}, loop);
}
{% endfor -%}
{% for trigger in triggers -%}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
{%- endmacro %}
#pragma once

#include "wpi/driverstation/{{ ConsoleName }}Controller.hpp"
#include "wpi/driverstation/nids/{{ ConsoleName }}Controller.hpp"

#include "wpi/commands2/button/Trigger.hpp"
#include "wpi/commands2/CommandScheduler.hpp"
#include "wpi/commands2/button/CommandGenericHID.hpp"

namespace wpi::cmd {
namespace wpi::cmd::nids {
/**
* A version of {@link wpi::{{ ConsoleName }}Controller} with {@link Trigger} factories for
* A version of {@link wpi::nids::{{ ConsoleName }}Controller} with {@link Trigger} factories for
* command-based.
*
* @see wpi::{{ ConsoleName }}Controller
* @see wpi::nids::{{ ConsoleName }}Controller
*/
class Command{{ ConsoleName }}Controller : public CommandGenericHID {
public:
Expand All @@ -36,7 +36,7 @@ class Command{{ ConsoleName }}Controller : public CommandGenericHID {
*
* @return the wrapped GenericHID object
*/
wpi::{{ ConsoleName }}Controller& GetHID();
wpi::nids::{{ ConsoleName }}Controller& GetHID();
{% for button in buttons %}
/**
* Constructs a Trigger instance around the {{ button.DocName|default(button.name) }} button's
Expand Down Expand Up @@ -88,6 +88,6 @@ class Command{{ ConsoleName }}Controller : public CommandGenericHID {
double Get{{ capitalize_first(trigger.name) }}Axis() const;
{% endfor %}
private:
wpi::{{ ConsoleName }}Controller m_hid;
wpi::nids::{{ ConsoleName }}Controller m_hid;
};
} // namespace wpi::cmd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading