Resurgence (PY2022)
Codebase for the Husky Robotics 2021-2022 rover Resurgence
Loading...
Searching...
No Matches
sim_motor.h
1#pragma once
2
3#include "../../network/websocket/WebSocketProtocol.h"
4#include "base_motor.h"
5
6#include <nlohmann/json.hpp>
7
12namespace robot {
13class sim_motor : public base_motor {
14public:
23 sim_motor(robot::types::motorid_t motor, bool hasPosSensor, const std::string& name,
24 const std::string& path);
25
26 void setMotorPower(double power) override;
27
28 void setMotorPos(int32_t targetPos) override;
29
31
32private:
33 std::string motor_name;
34 std::string protocol_path;
35 void sendJSON(const nlohmann::json& obj);
36}; // class sim_motor
37} // namespace robot
_Tp power(_Tp __x, _Integer __n, _MonoidOperation __monoid_op)
_GLIBCXX_END_NAMESPACE_CXX11 typedef basic_string< char > string
base_motor(robot::types::motorid_t motor, bool hasPosSensor)
Constructor for base motor.
Definition base_motor.cpp:6
void setMotorPos(int32_t targetPos) override
Set the target position of the motor.
Definition sim_motor.cpp:21
sim_motor(robot::types::motorid_t motor, bool hasPosSensor, const std::string &name, const std::string &path)
Constructor for can motor.
Definition sim_motor.cpp:9
void setMotorPower(double power) override
Set the PWM command of the motor.
Definition sim_motor.cpp:13
types::DataPoint< int32_t > getMotorPos() const override
Get the last reported position of the specified motor.
Definition sim_motor.cpp:30
Represents data measured using a sensor at a given time.
Definition data.h:136
::int32_t int32_t
basic_json<> json
motorid_t
The motors on the robot.
Definition data.h:57
Collection of functions for manipulating a motor.
Definition ArduPilotInterface.cpp:27