Resurgence (PY2022)
Codebase for the Husky Robotics 2021-2022 rover Resurgence
Toggle main menu visibility
Loading...
Searching...
No Matches
src
world_interface
motor
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
12
namespace
robot
{
13
class
sim_motor
:
public
base_motor
{
14
public
:
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
30
void
setServoPos(
uint8_t
servo,
int32_t
position)
override
;
31
32
void
setStepperTurnAngle(
uint8_t
stepper,
int16_t
angle)
override
;
33
34
types::DataPoint<int32_t>
getMotorPos
()
const override
;
35
36
private
:
37
std::string
motor_name;
38
std::string
protocol_path;
39
void
sendJSON(
const
nlohmann::json
& obj);
40
};
// class sim_motor
41
}
// namespace robot
power
_Tp power(_Tp __x, _Integer __n, _MonoidOperation __monoid_op)
std::string
_GLIBCXX_END_NAMESPACE_CXX11 typedef basic_string< char > string
robot::base_motor::base_motor
base_motor(robot::types::motorid_t motor, bool hasPosSensor)
Constructor for base motor.
Definition
base_motor.cpp:6
robot::sim_motor::setMotorPos
void setMotorPos(int32_t targetPos) override
Set the target position of the motor.
Definition
sim_motor.cpp:21
robot::sim_motor::sim_motor
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
robot::sim_motor::setMotorPower
void setMotorPower(double power) override
Set the PWM command of the motor.
Definition
sim_motor.cpp:13
robot::sim_motor::getMotorPos
types::DataPoint< int32_t > getMotorPos() const override
Get the last reported position of the specified motor.
Definition
sim_motor.cpp:30
robot::types::DataPoint
Represents data measured using a sensor at a given time.
Definition
data.h:182
uint8_t
::uint8_t uint8_t
int32_t
::int32_t int32_t
int16_t
::int16_t int16_t
nlohmann::json
basic_json<> json
robot::types::motorid_t
motorid_t
The motors on the robot.
Definition
data.h:57
robot
Collection of functions for manipulating a motor.
Definition
ArduPilotInterface.cpp:27
Generated by
1.17.0