I want to dynamically instruct velocity and angular velocity to BlueROV by python program.
I think set_target_depth in Pymavlink is one solution, but it maybe not finish until reach to target position. (Is it correct?)
Initial status is vx=0.0(m/s) yaw-rate=0.0(rad/s)
If I am about to change the status to vx=0.5, yr=0.5 (real-status 0.3, 0.3) and then want to change it to 0.0, 0.0, is it possible to execute a new function during the execution of the function?
If not, what is the solution?
I will change type_mask in set_target_depth
First of all, is it correct?
The SET_POSITION_TARGET_GLOBAL_INT MAVLink message (which is used in our example set_target_depth function) sets the current target for the vehicle to aim for - there’s no requirement to meet/achieve the current target in order for a new target to be specified instead.
That said, using that message currently requires a position-enabled flight mode (like Depth Hold, if you only want to control vertical position, or Guided mode if you want to target horizontal positions/velocities as well), which means it requires a position estimate (from a barometer for depth; or from a DVL, underwater GPS, etc for horizontal control).
Hmm, that does seem to be the case if you want to use ArduSub to do the control for you (by setting targets for it to follow). I’m unsure whether it would be difficult to add yaw rate control as an option.
If having control of forward velocity and yaw-rate is important you could either modify ArduSub, or create your own external control loop via pymavlink that uses the telemetry information to determine which control commands to send. It would be more efficient and effective to do in ArduSub, but it’s possible an external approach would be simpler to implement.
Our thrust vs input signal curves likely do not hold precisely for thrust at speed.
If you’re targeting a specific desired velocity, and you have an estimate of current velocity and a method to tell the vehicle to move faster or slower, you can implement whichever control algorithm you like to control the vehicle commands based on the “error” between the desired and current velocity.
Depending on your precision and transfer time requirements different approaches may or may not be sufficient for your purpose.
A reasonably simple approach is to use just proportional control, where if the error is large you apply a large control action (e.g. if you are much slower than desired you significantly increase the commanded throttle), and if the error is small you apply a small (or zero) control action (change the commanded throttle by a small amount, or leave it as is). The amount to change by is determined by the error multiplied by a scaling factor, which is a parameter of the algorithm that you can tune.
If you need more advanced control you can use a full PID controller (proportional, integral, derivative), which is still reasonably simple (and will have many implementations available online), but has some additional tuning parameters that help to dampen oscillations and correct for long duration small errors.
Beyond that you could potentially go to a more advanced controller, but if that’s deemed to be necessary then it’s almost certainly worth implementing the control within ArduSub instead, since it has access to much higher sensor measurement frequencies, and can apply control actions with lower latency.
I’m going to try to implement 6-DoF Modelling and Control of a Remotely Operated Vehicle with this as a reference for now.
Do you know how much some parameters (e.g. inertia moment ) in the kinetic model should be?
I have a BlueROV heavy coniguration with various things attached like scanning sonar, waterlinked DLV, payloads kid, etc. so it might be very different from the original state.
Or do you know how to measure these parameters?
If all you’re after is velocity control, this seems like way more effort than should be necessary.
There’s some discussion of the parameters in this thread. Blue Robotics has not done measurements of them, and correct values would depend on the vehicle configuration in use (including added components).
If there are specific parameters you’re interested in and can’t readily find out how to estimate we can try to discuss them. Some may have already been discussed in posts with the #vehicle-design tag. Some may be challenging to measure without specialised equipment, and may require fluid simulation software to estimate accurately.
I try to rotate the thruster by sending PWM value with MAV_CMD_DO_MOTOR_TEST , but the thruster do not rotate. (channel 1-8)
when I try to bright the light in the same way, I can change the brightness.(channel 9)
How can I solve it?
Normally you would use RC_CHANNELS_OVERRIDE or MANUAL_CONTROL messages, although it’s technically also possible to use MAV_CMD_DO_SET_SERVO if you configure the motor outputs as “Disabled” in the SERVOn_FUNCTION parameters (instead of their usual MotorN values), as I mentioned in the post you linked to (with the caveats mentioned there).
If you wanted to try it with MAV_CMD_DO_MOTOR_TEST I imagine you would just need to send multiple in short succession, but I don’t know if it would work and haven’t tried. That message is also not intended for general motor control, so if it does work at the moment that doesn’t guarantee it would continue working in future, so it’s not an approach I’d recommend if other options are also available.