Class hal::rmd::mc_x
Driver for RMD series motors equip with the MC-X motor driver.
#include <mc_x.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 |
---|---|
const feedback_t & | feedback () const Get feedback about the motor. |
status | feedback_request (read p_command) Request feedback from the motor. |
mc_x (mc_x & p_other) = delete |
|
mc_x (mc_x && p_other) noexcept |
|
void | operator() (const can::message_t & p_message) Handle messages from the can bus with this devices ID. |
mc_x & | operator= (mc_x & p_other) = delete |
mc_x & | operator= (mc_x && 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< mc_x > | 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 mc_x device driver. |
Public Types Documentation
enum actuate
enum hal::rmd::mc_x::actuate {
torque = 0xA1,
speed = 0xA2,
position = 0xA5
};
enum read
enum hal::rmd::mc_x::read {
multi_turns_angle = 0x92,
status_1_and_error_flags = 0x9A,
status_2 = 0x9C
};
enum system
enum hal::rmd::mc_x::system {
off = 0x80,
stop = 0x81
};
enum write
enum hal::rmd::mc_x::write;
Public Functions Documentation
function feedback
Get feedback about the motor.
const feedback_t & hal::rmd::mc_x::feedback () const
This object contains cached data from each response returned from the motor. It is updated when any of the control or feedback APIs are called. This object will not update without one of those APIs being called.
Returns:
const feedback_t& - information about the motor
Exception:
std::errc::timed_out
- if a response is not returned within the max response time set at creation.
function feedback_request
Request feedback from the motor.
status hal::rmd::mc_x::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 mc_x [1/3]
hal::rmd::mc_x::mc_x (
mc_x & p_other
) = delete
function mc_x [2/3]
hal::rmd::mc_x::mc_x (
mc_x && p_other
) noexcept
function operator()
Handle messages from the can bus with this devices ID.
void hal::rmd::mc_x::operator() (
const can::message_t & p_message
)
Meant mostly for testing purposes.
Parameters:
p_message
- message received from the bus
function operator=
mc_x & hal::rmd::mc_x::operator= (
mc_x & p_other
) = delete
function operator=
mc_x & hal::rmd::mc_x::operator= (
mc_x && p_other
) noexcept
function position_control
Move motor shaft to a specific angle.
status hal::rmd::mc_x::position_control (
degrees p_angle,
rpm speed
)
Parameters:
p_angle
- angle position in degrees to move tospeed
- 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::mc_x::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::mc_x::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 mc_x device driver.
static result< mc_x > hal::rmd::mc_x::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)
)
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<mc_x> - the mc_x driver or an error (no errors are currently generated from this function)
The documentation for this class was generated from the following file libraries/include/libhal-rmd/mc_x.hpp