Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter to choose whether to stop the control on internal limit #461

Open
wants to merge 1 commit into
base: melodic-devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion canopen_402/include/canopen_402/motor.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ class Motor402 : public MotorBase
: MotorBase(name), status_word_(0),control_word_(0),
switching_state_(State402::InternalState(settings.get_optional<unsigned int>("switching_state", static_cast<unsigned int>(State402::Operation_Enable)))),
monitor_mode_(settings.get_optional<bool>("monitor_mode", true)),
state_switch_timeout_(settings.get_optional<unsigned int>("state_switch_timeout", 5))
state_switch_timeout_(settings.get_optional<unsigned int>("state_switch_timeout", 5)),
stop_on_internal_limit_(settings.get_optional<bool>("stop_on_internal_limit", true))
{
storage->entry(status_word_entry_, 0x6041);
storage->entry(control_word_entry_, 0x6040);
Expand Down Expand Up @@ -377,6 +378,7 @@ class Motor402 : public MotorBase
const State402::InternalState switching_state_;
const bool monitor_mode_;
const boost::chrono::seconds state_switch_timeout_;
const bool stop_on_internal_limit_;

canopen::ObjectStorage::Entry<uint16_t> status_word_entry_;
canopen::ObjectStorage::Entry<uint16_t > control_word_entry_;
Expand Down
2 changes: 1 addition & 1 deletion canopen_402/src/motor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ bool Motor402::readState(LayerStatus &status, const LayerState &current_state){
status.warn("mode does not match");
}
if(sw & (1<<State402::SW_Internal_limit)){
if(old_sw & (1<<State402::SW_Internal_limit) || current_state != Ready){
if(!stop_on_internal_limit_ || old_sw & (1<<State402::SW_Internal_limit) || current_state != Ready){
status.warn("Internal limit active");
}else{
status.error("Internal limit active");
Expand Down