Class hal::rmd::drc
Driver for RMD motors equip with the DRC motor drivers.
#include <drc.hpp>
Classes
| Type | Name |
|---|---|
| struct | feedback_t |
Public Types
| Type | Name |
|---|---|
| enum hal::byte | actuate Commands for actuate the motor. |
| enum hal::byte | read Commands that can be issued to a RMD-X motor. |
| enum hal::byte | system Commands for controlling the motor as a whole. |
| enum hal::byte | write Commands for updating motor configuration data. |
Public Functions
| Type | Name |
|---|---|
| drc (drc & p_other) = delete |
|
| drc (drc && p_other) noexcept |
|
| const feedback_t & | feedback () const |
| status | feedback_request (read p_command) Request feedback from the motor. |
| void | operator() (const can::message_t & p_message) Handle messages from the canbus with this devices ID. |
| drc & | operator= (drc & p_other) = delete |
| drc & | operator= (drc && p_other) noexcept |
| status | position_control (degrees p_angle, rpm speed) Move motor shaft to a specific angle. |
| status | system_control (system p_system_command) Send system control commands to the device. |
| status | velocity_control (rpm p_speed) Rotate motor shaft at the designated speed. |
Public Static Functions
| Type | Name |
|---|---|
| result< drc > | create (hal::can_router & p_router, hal::steady_clock & p_clock, float p_gear_ratio, can::id_t device_id, hal::time_duration p_max_response_time=std::chrono::milliseconds(10)) Create a new drc device driver. |
Public Types Documentation
enum actuate
enum hal::rmd::drc::actuate {
speed = 0xA2,
position_2 = 0xA4
};
enum read
enum hal::rmd::drc::read {
multi_turns_angle = 0x92,
status_1_and_error_flags = 0x9A,
status_2 = 0x9C
};
enum system
enum hal::rmd::drc::system {
clear_error_flag = 0x9B,
off = 0x80,
stop = 0x81,
running = 0x88
};
enum write
enum hal::rmd::drc::write {
pid_to_ram = 0x31,
pid_to_rom = 0x32,
acceleration_data_to_ram = 0x34,
encoder_offset = 0x91,
current_position_to_rom_as_motor_zero = 0x19
};
Public Functions Documentation
function drc [1/3]
hal::rmd::drc::drc (
drc & p_other
) = delete
function drc [2/3]
hal::rmd::drc::drc (
drc && p_other
) noexcept
function feedback
const feedback_t & hal::rmd::drc::feedback () const
function feedback_request
Request feedback from the motor.
status hal::rmd::drc::feedback_request (
read p_command
)
Parameters:
p_command- the request to command the motor to respond with
Returns:
status - success or failure
Exception:
std::errc::timed_out- if a response is not returned within the max response time set at creation.
function operator()
Handle messages from the canbus with this devices ID.
void hal::rmd::drc::operator() (
const can::message_t & p_message
)
Meant mostly for testing purposes.
Parameters:
p_message- message received from the bus
function operator=
drc & hal::rmd::drc::operator= (
drc & p_other
) = delete
function operator=
drc & hal::rmd::drc::operator= (
drc && p_other
) noexcept
function position_control
Move motor shaft to a specific angle.
status hal::rmd::drc::position_control (
degrees p_angle,
rpm speed
)
Parameters:
p_angle- angle position in degrees to move tospeed- maximum speed in rpm's
Returns:
status - success or failure
Exception:
std::errc::timed_out- if a response is not returned within the max response time set at creation.
function system_control
Send system control commands to the device.
status hal::rmd::drc::system_control (
system p_system_command
)
Parameters:
p_system_command- system control command to send to the device
Returns:
status - success or failure status
Exception:
std::errc::timed_out- if a response is not returned within the max response time set at creation.
function velocity_control
Rotate motor shaft at the designated speed.
status hal::rmd::drc::velocity_control (
rpm p_speed
)
Parameters:
p_speed- speed in rpm to move the motor shaft at. Positive values rotate the motor shaft clockwise, negative values rotate the motor shaft counter-clockwise assuming you are looking directly at the motor shaft.
Returns:
status - success or failure
Exception:
std::errc::timed_out- if a response is not returned within the max response time set at creation.
Public Static Functions Documentation
function create
Create a new drc device driver.
static result< drc > hal::rmd::drc::create (
hal::can_router & p_router,
hal::steady_clock & p_clock,
float p_gear_ratio,
can::id_t device_id,
hal::time_duration p_max_response_time=std::chrono::milliseconds(10)
)
This factory function will power cycle the motor
Parameters:
p_router- can router to usep_clock- clocked used to determine timeoutsp_gear_ratio- gear ratio of the motordevice_id- The CAN ID of the motorp_max_response_time- maximum amount of time to wait for a response from the motor.
Returns:
result<drc> - the drc driver or an error
Exception:
std::errc::timed_out- a response is not returned within the max response time when attempting to power cycle.
The documentation for this class was generated from the following file libraries/include/libhal-rmd/drc.hpp