WPILibC++ 2024.3.2
MechanismRoot2d.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <memory>
8#include <string_view>
9
11
12#include "MechanismObject2d.h"
13
14namespace frc {
15
16/**
17 * Root Mechanism2d node.
18 *
19 * A root is the anchor point of other nodes (such as ligaments).
20 *
21 * Do not create objects of this class directly! Obtain pointers from the
22 * Mechanism2d.GetRoot() factory method.
23 *
24 * <p>Append other nodes by using Append().
25 */
27 friend class Mechanism2d;
28 struct private_init {};
29
30 public:
31 MechanismRoot2d(std::string_view name, double x, double y,
32 const private_init&);
33
34 /**
35 * Set the root's position.
36 *
37 * @param x new x coordinate
38 * @param y new y coordinate
39 */
40 void SetPosition(double x, double y);
41
43
45
46 private:
47 void UpdateEntries(std::shared_ptr<nt::NetworkTable> table) override;
48 inline void Flush();
49 double m_x;
50 double m_y;
53};
54} // namespace frc
Visual 2D representation of arms, elevators, and general mechanisms through a node-based API.
Definition: Mechanism2d.h:43
Common base class for all Mechanism2d node types.
Definition: MechanismObject2d.h:31
T * Append(std::string_view name, Args &&... args)
Append a Mechanism object that is based on this one.
Definition: MechanismObject2d.h:67
const std::string & GetName() const
Retrieve the object's name.
Root Mechanism2d node.
Definition: MechanismRoot2d.h:26
MechanismRoot2d(std::string_view name, double x, double y, const private_init &)
void SetPosition(double x, double y)
Set the root's position.
NetworkTables Double publisher.
Definition: DoubleTopic.h:113
basic_string_view< char > string_view
Definition: core.h:501
Definition: AprilTagPoseEstimator.h:15