-
Notifications
You must be signed in to change notification settings - Fork 770
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm :)
…s_simulator into feature/multimotor_plugin
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"; | ||
} |
There was a problem hiding this comment.
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?
getSdfParam<double>(motor_, "maxRotVelocity", max_rot_velocity_, max_rot_velocity_); | ||
getSdfParam<double>(motor_, "minRotVelocity", min_rot_velocity_, min_rot_velocity_); |
There was a problem hiding this comment.
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.
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_); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 ?
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