Hi, I am attempting to manually control the blueROV2 with a Jetson Nano connected over the Telem 2 port of the Pixhawk. I am using mavsdk and c++ to do this. I have also tried to use Python just to get it working, but no luck with either.
I am able to do things such as arm/disarm, request messages such as NAV_CONTROLLER_OUTPUT through Python or C++, but I cannot get the motors to respond to a manual control or RC_override command.
Here is an example of my C++ functions for RC_Override and Manual Control.
bool send_rc_override(MavlinkPassthrough &_mavlink_pass){
mavlink_message_t message2;
qDebug() << "System ID" << QString::number(_mavlink_pass.get_our_sysid()) << "\n" <<
"Comp ID" << QString::number(_mavlink_pass.get_our_compid()) << "\n" <<
"Target ID" << QString::number(_mavlink_pass.get_target_sysid()) << "\n" <<
"Target Comp ID" << QString::number(_mavlink_pass.get_target_compid()) << "\n";
mavlink_msg_rc_channels_override_pack(_mavlink_pass.get_our_sysid(),
_mavlink_pass.get_our_compid(),
&message2,
_mavlink_pass.get_target_sysid(),
_mavlink_pass.get_target_compid(),
1450,
UINT16_MAX,
1450,
UINT16_MAX,
UINT16_MAX,
UINT16_MAX,
UINT16_MAX,
UINT16_MAX,
UINT16_MAX-1,
UINT16_MAX-1,
UINT16_MAX-1,
UINT16_MAX-1,
UINT16_MAX-1,
UINT16_MAX-1,
UINT16_MAX-1,
UINT16_MAX-1,
UINT16_MAX-1,
UINT16_MAX-1);
if (_mavlink_pass.send_message(message2) == MavlinkPassthrough::Result::Success){
qDebug() << "Successfully sent RC message \n";
}
return true;
}
bool send_manual_control(MavlinkPassthrough &_mavlink_pass){
mavlink_message_t message1;
mavlink_msg_manual_control_pack(_mavlink_pass.get_our_sysid(),
_mavlink_pass.get_our_compid(),
&message1,
_mavlink_pass.get_target_sysid(),
400,
400,
400,
400,
0,
0,
0,
0,
0);
if (_mavlink_pass.send_message(message1) == MavlinkPassthrough::Result::Success){
qDebug() << "Successfully sent RC message \n";
}
return true;
}
These functions are run after creating a MavlinkPassthrough instance such as
auto mavlink_pass = MavlinkPassthrough{system};
When doing manual control, I can even see in QCGround Control that the manual control message is being received with my given parameters, but the motors are not responding.
With my Python code, I can do something like this
# Import mavutil
from pymavlink import mavutil
import time
master = mavutil.mavlink_connection("/dev/ttyACM0", baud=115200)
# Wait a heartbeat before sending commands
master.wait_heartbeat()
print("Heartbeat Heard")
heartbeat = mavutil.periodic_event(1)
motor = mavutil.periodic_event(0.1)
start = time.time()
duration = 160 # seconds
while (time.time() - start < duration):
if heartbeat.trigger():
master.mav.heartbeat_send(mavutil.mavlink.MAV_TYPE_GCS,
mavutil.mavlink.MAV_AUTOPILOT_INVALID,
0,0,0)
if motor.trigger():
master.mav.manual_control_send(
master.target_system,
0,
0,
490,
0,
0)
print("count")
and I can see the output in QCGround Control for a second or so, then the messages stop sending and the code freezes.
I am really concerned that my serial buffer is getting overloaded or something. I have no clue where to go with this from here. Hopefully, someone has a suggestion.
Also, note that I arm the vehicle manually for the python code as sometimes it arms and sometimes it does not.
I also run the C++ send message function in a loop, so its not that I am only sending it once