mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-02-07 16:01:52 +08:00
add ascii q command
This commit is contained in:
@@ -3,6 +3,7 @@ Please add a note of your changes below this heading if you make a Pull Request.
|
||||
|
||||
### Added
|
||||
* `dump_errors()` utility function in odrivetool to dump, decode and optionally clear errors.
|
||||
* `q` command to ascii protocol. It is like the old `p` command, but velocity and current mean limits, not feed-forward.
|
||||
|
||||
# Releases
|
||||
## [0.4.7] - 2018-11-28
|
||||
|
||||
@@ -102,6 +102,21 @@ void ASCII_protocol_process_line(const uint8_t* buffer, size_t len, StreamSink&
|
||||
axes[motor_number]->controller_.set_pos_setpoint(pos_setpoint, vel_feed_forward, current_feed_forward);
|
||||
}
|
||||
|
||||
} else if (cmd[0] == 'q') { // position control with limits
|
||||
unsigned motor_number;
|
||||
float pos_setpoint, vel_limit, current_lim;
|
||||
int numscan = sscanf(cmd, "q %u %f %f %f", &motor_number, &pos_setpoint, &vel_limit, ¤t_lim);
|
||||
if (numscan < 4) {
|
||||
respond(response_channel, use_checksum, "invalid command format");
|
||||
} else if (motor_number >= AXIS_COUNT) {
|
||||
respond(response_channel, use_checksum, "invalid motor %u", motor_number);
|
||||
} else {
|
||||
Axis* axis = axes[motor_number];
|
||||
axis->controller_.pos_setpoint_ = pos_setpoint;
|
||||
axis->controller_.config_.vel_limit = vel_limit;
|
||||
axis->motor_.config_.current_lim = current_lim;
|
||||
}
|
||||
|
||||
} else if (cmd[0] == 'v') { // velocity control
|
||||
unsigned motor_number;
|
||||
float vel_setpoint, current_feed_forward;
|
||||
|
||||
Reference in New Issue
Block a user