WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
MechanismRoot2d.hpp
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
12
13namespace wpi {
14
15/**
16 * Root Mechanism2d node.
17 *
18 * A root is the anchor point of other nodes (such as ligaments).
19 *
20 * Do not create objects of this class directly! Obtain pointers from the
21 * Mechanism2d.GetRoot() factory method.
22 *
23 * <p>Append other nodes by using Append().
24 */
26 friend class Mechanism2d;
27 struct private_init {};
28
29 public:
30 MechanismRoot2d(std::string_view name, double x, double y,
31 const private_init&);
32
33 /**
34 * Set the root's position.
35 *
36 * @param x new x coordinate
37 * @param y new y coordinate
38 */
39 void SetPosition(double x, double y);
40
42
44
45 private:
46 void UpdateEntries(std::shared_ptr<wpi::nt::NetworkTable> table) override;
47 inline void Flush();
48 double m_x;
49 double m_y;
52};
53} // namespace wpi
@ name
Definition base.h:690
MechanismObject2d(std::string_view name)
const std::string & GetName() const
Retrieve the object's name.
T * Append(std::string_view name, Args &&... args)
Append a Mechanism object that is based on this one.
Definition MechanismObject2d.hpp:66
MechanismRoot2d(std::string_view name, double x, double y, const private_init &)
void SetPosition(double x, double y)
Set the root's position.
friend class Mechanism2d
Definition MechanismRoot2d.hpp:26
NetworkTables Double publisher.
Definition DoubleTopic.hpp:127
Definition CvSource.hpp:15