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

[Bug] modifications on print_status() in ControlAllocator have no effect #23938

Open
JaimeParker opened this issue Nov 13, 2024 · 5 comments
Open

Comments

@JaimeParker
Copy link

JaimeParker commented Nov 13, 2024

Describe the bug

after revising custom print in ControlAllocator.cpp like this:

if (_actuator_effectiveness != nullptr) {
		PX4_INFO("Effectiveness Source: %s", _actuator_effectiveness->name());
	}

	// Print current effectiveness matrix
	for (int i = 0; i < _num_control_allocation; ++i) {
		const ActuatorEffectiveness::EffectivenessMatrix &effectiveness = _control_allocation[i]->getEffectivenessMatrix();

		if (_num_control_allocation > 1) {
			PX4_INFO("Instance: %i", i);
		}

		PX4_INFO("  custom print test.");
		PX4_INFO("  Effectiveness.T =");
		effectiveness.T().print();
		PX4_INFO("  minimum =");
		_control_allocation[i]->getActuatorMin().T().print();
		PX4_INFO("  maximum =");
		_control_allocation[i]->getActuatorMax().T().print();
		PX4_INFO("  actuator_trim =");
		_control_allocation[i]->getActuatorTrim().T().print();
		PX4_INFO("  control_trim =");
		_control_allocation[i]->getControlTrim().T().print();
		PX4_INFO("  Configured actuators: %i", _control_allocation[i]->numConfiguredActuators());
	}

and defining functions in ControlAllocation.hpp:

        const matrix::Vector<float, NUM_ACTUATORS> &getActuatorTrim() const { return _actuator_trim; }
	const matrix::Vector<float, NUM_AXES> &getControlTrim() const { return _control_trim; }

then,

<arg name="vehicle" default="iris_ctrlalloc"/>

and run roslaunch px4 mavros_posix_sitl.launch

then in the px4 terminal, run commander takeoff and control_allocator status

will got no new added message printed, even the string.

To Reproduce

  • using PX4 Release/1.13
  • revise ControlAllocator.cpp and ControlAllocation.hpp like above
  • revise the launch file to use iris allocation model
  • roslaunch
  • run control_allocator status to check

Expected behavior

at least the added:

PX4_INFO("  custom print test.");

should be printed

Screenshot / Media

微信图片_20241114011512

微信图片_20241114012130

Flight Log

No response

Software Version

PX4 Release/1.13

Flight controller

px4 sitl gazebo

Vehicle type

Multicopter

How are the different components wired up (including port information)

No response

Additional context

if u think this should not be a [bug] issue, welcome to discuss in the forum and close this issue, thanks a lot!

@dakejahl
Copy link
Contributor

The code isn't getting recompiled. Try deleting the build directory

make clean && rm -rf build

make sure you're running the same code that you're building, that you don't accidentally have two px4 repositories downloaded.

@JaimeParker
Copy link
Author

@dakejahl Thanks for that! I double checked that I have only one PX4 repo, and run

make clean && rm -rf build

the whole build folder is removed, and the next make px4_sitl gazbeo took longer time, but it still failed, without any custom message printed.

@dakejahl
Copy link
Contributor

then your changes must not be getting saved, check git status

@JaimeParker
Copy link
Author

JaimeParker commented Nov 18, 2024

@dakejahl thanks again, but weird, it do has modificaiton

image

@JaimeParker
Copy link
Author

JaimeParker commented Nov 18, 2024

it works only in

make px4_sitl gazebo_iris_ctrlalloc

image

if using

roslaunch px4 mavros_poxis_sitl.launch

all custom messages will not be printed.

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

No branches or pull requests

2 participants