Can't change parameters in px4 by VEHICLE_CMD_DO_SET_PARAMETER

i am conduct a simulation,my environment is below:

operation system:ubuntu 22.04
px4:1.14.0-rc1

and the version of gazebo and MicroXRCE is following the guide of installing,
then i want to change some default parameter in px4 by using the VEHICLE_CMD_DO_SET_PARAMETER in ros2,but when i invoked the code

	this->publish_vehicle_command(VehicleCommand::VEHICLE_CMD_DO_SET_PARAMETER,982,12.0);

the define of function is below:

void DroneRTPS::publish_vehicle_command(uint16_t command, float param1, float param2, float param3, float param4, float param5, float param6, float param7)
{
	VehicleCommand msg{};
	msg.timestamp = _timestamp.load();
	msg.param1 = param1;
	msg.param2 = param2;
    msg.param3 = param3;
    msg.param4 = param4;
    msg.param5 = param5;
    msg.param6 = param6;
    msg.param7 = param7;
	msg.command = command;
	msg.target_system = 1;
	msg.target_component = 1;
	msg.source_system = 1;
	msg.source_component = 1;
	msg.from_external = true;
	_vehicle_command_publisher->publish(msg);
}

i can’t see the change of the parameter in px4,so what should i do to change the parameter in px4 by ros2 code

Hi @qingchu123 , even though VehicleCommand::VEHICLE_CMD_DO_SET_PARAMETER exists, it is not truly implemented. If I remember correctly, parameter change can only be made using Mavlink message
PARAM_SET

1 Like

oh,thank you for your detail reply!,i will try it!

Hello. So how am I supposed to send param_set using ROS2? Can you give a sample?

If by writing “using ROS2” you mean NOT mavros, than you can’t at the moment. If you are using mavros, then take a look at https://wiki.ros.org/mavros#mavparam

@Benja is this still the case? Should PX4 ROS 2 Control Interface | PX4 User Guide (main) solve this in v1.15?

is this still the case?

@cbugk yes it is.

Should PX4 ROS 2 Control Interface | PX4 User Guide (main) solve this in v1.15?

@bkueng do you know about this?

1 Like

No, there’s no interface for that yet.
However, in general changing parameters from an offboard application isn’t the best solution, especially if you want to do it regularly.
Which parameter(s) do you want to change?