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

Feature/multimotor plugin #659

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open

Conversation

karenbodie
Copy link
Contributor

@karenbodie karenbodie commented Feb 16, 2021

EDITED DESCRIPTION: Adds a multi-motor plugin that currently includes rotor and servo options.

URDF setup

All motors are added in one plugin via their corresponding joints, an example is in omav3_actuators.xacro.
For a system with n rotors and m servos, Actuator numbers are (0 - n-1) rotors in order they are included in the xml, and (n - m-1) servos. Regardless of the order of servos or rotors blocks, rotors will come first.

Messages

Commands are received jointly in a mav_msgs::Actuators message. Missing fields are set to nan and extra fields are ignored. Rotors handle nan by setting to zero velocity. This could be adapted based on real actuator/esc behaviour. Servos do not update joint controllers if a nan is received.

Feedback

Feedback is published jointly in a mav_msgs::Actuators message which contains an array of positions, velocities, and efforts (e.g. torque), one for each motor. Rotors publish zero for position (angles).

Launch example

An example for OMAV3 is in omav_simulation.launch

resolves #492

Copy link
Contributor

@ffurrer ffurrer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm :)

Comment on lines +43 to +48
if (IsValidLink(motor) & IsValidJoint(motor)) {
motors_.push_back(std::make_unique<MotorModelRotor>(model_, motor));
gzdbg << "[gazebo_multimotor_plugin] Loaded rotor!\n";
} else {
gzdbg << "[gazebo_multimotor_plugin] Failed to load rotor!\n";
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jenkins fails on 16.04 because std::make_unique is apparently a feature of c++14?

error: 'make_unique' is not a member of 'std'

@michaelpantic what would be the right way to do this?

Comment on lines +107 to +108
getSdfParam<double>(motor_, "maxRotVelocity", max_rot_velocity_, max_rot_velocity_);
getSdfParam<double>(motor_, "minRotVelocity", min_rot_velocity_, min_rot_velocity_);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

max and min rot velocity loaded but never used.

Comment on lines +97 to +99
getSdfParam<double>(motor_, "maxRotVelocity", max_rot_velocity_, max_rot_velocity_);
getSdfParam<double>(motor_, "maxRotPosition", max_rot_position_, max_rot_position_);
getSdfParam<double>(motor_, "minRotPosition", min_rot_position_, min_rot_position_);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Position and velocity limits loaded but never used.

// Frame ID is not used for this particular message
actuator_state_msg.mutable_header()->set_frame_id("");

motor_state_pub_->Publish(actuator_state_msg);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Current publishing on simulation update, which is not realistic. Should probably align with the real system. We could:

  • poll in the command function, but then we wouldn't see feedback when no commands sent.
  • poll based on a timed callback

What do you think @clanegge @michaelpantic ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Additional packages required for succesful build
4 participants