simulation/gz_bridge: rc_cessna plane model working, Gazebo Garden updates, and prepare for proper airspeed (#20989)

Co-authored-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
This commit is contained in:
Benjamin Perseghetti
2023-01-24 19:01:45 -05:00
committed by GitHub
parent fbd2e111d0
commit 684b4a4b8a
26 changed files with 348 additions and 100 deletions
@@ -35,12 +35,12 @@
bool GZMixingInterfaceServo::init(const std::string &model_name)
{
// /model/plane_0/joint/left_elevon_joint/0/cmd_pos
// /model/rascal_110_0/px4_servo_2
for (int i = 0; i < 8; i++) {
std::string joint_name = "px4_servo_" + std::to_string(i);
std::string servo_topic = "/model/" + model_name + "/joint/" + joint_name + "/0/cmd_pos";
std::string servo_topic = "/model/" + model_name + "/" + joint_name;
//std::cout << "Servo topic: " << servo_topic << std::endl;
_servos_pub.push_back(_node.Advertise<ignition::msgs::Double>(servo_topic));
_servos_pub.push_back(_node.Advertise<gz::msgs::Double>(servo_topic));
if (!_servos_pub.back().Valid()) {
PX4_ERR("failed to advertise %s", servo_topic.c_str());
@@ -63,7 +63,7 @@ bool GZMixingInterfaceServo::updateOutputs(bool stop_motors, uint16_t outputs[MA
for (auto &servo_pub : _servos_pub) {
if (_mixing_output.isFunctionSet(i)) {
ignition::msgs::Double servo_output;
gz::msgs::Double servo_output;
///TODO: Normalize output data
double output = (outputs[i] - 500) / 500.0;
// std::cout << "outputs[" << i << "]: " << outputs[i] << std::endl;