Error using guided mode

In guided mode I’m trying to move to a specific lat lon using the following pymavlink command

master.mav.set_position_target_global_int_send(
0, # time_boot_ms (not used)
master.target_system,
master.target_component,
mavutil.mavlink.SET_POSITION_TARGET_GLOBAL_INT,
3, # coordinate frame - mav_frame global
3580, # type mask - use position
30391986, # latitiude *1e7
-97901289, # longitude *1e7
0, # altitude in m above sea level, home or terrain
0, # x vel in m/s positive is north
0, # y vel
0, # z vel
0, # accel x
0, # accel y
0, # accel z
0, # yaw in rad - 0 is forward
0) # yaw rate rad/s

The error I’m getting is as follows:

AttributeError: module 'pymavlink.dialects.v20.ardupilotmega' has no attribute 'SET_POSITION_TARGET_GLOBAL_INT'

I’ve checked that the SET_POSITION_TARGET_GLOBAL_INT enum is in my python3.8/site-packages/pymavlink/dialects/v20/common.xml file.

I’m using

pymavlink 2.4.41
arduboat 4.3.13

Any help fixing the error is much appreciated!

Hi @TMJ,

What are you attempting to do with your fifth code line? You’re already specifying the message type in the function name (in your first line), so I’m not sure why the fifth line is there or what you’re expecting it to do. Checking the mavutil.mavlink module also reveals that SET_POSITION_TARGET_GLOBAL_INT is not a variable within it, although there are various relevant variables for the enum flags (e.g. POSITION_TARGET_TYPEMASK_AX_IGNORE), and there’s a variable for the message ID (MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT), although that’s not relevant given you’re using a function dedicated to that message.

In case it’s relevant, we have an (old) example of using that message here, with a focus on setting a depth target for ArduSub. It may help to follow the syntax and structure used there, with the values changed as appropriate for your use-case :slight_smile:

Thanks Eliot. This works:

master.mav.set_position_target_global_int_send(
0, # time_boot_ms (not used)
master.target_system,
master.target_component,
mavutil.mavlink.MAV_FRAME_GLOBAL_INT, # coordinate frame - mav_frame global
3580, # type mask - use position
30391280, #30391986, # latitiude *1e7 30391280 -97902180
-97902180, #-97901289, # longitude *1e7
-.9, # altitude in m above sea level, home or terrain
0, # x vel in m/s positive is north
0, # y vel
0, # z vel
0, # accel x
0, # accel y
0, # accel z
0, # yaw in rad - 0 is forward
0) # yaw rate rad/s

Hi @TMJ

Do you use the boat indoors or outdoors?

For my purposes, I need to use the boat indoors, so the GPS is disabled from prearming, but the robot does not accept the target?

I use the DVL instead.

I tried your solution and the other function from pymavlink.

@EliotBR, can you please provide information on whether it is possible to provide the goal to the vehicle (command in Mavlink) without GPS, so the vehicle will move?

Of course, I can perform all general operations (arm, disarm, or move thrusters), but I am unable now to set the position of the boat.

Outdoors, the robot works, as the boat can use the GPS. QGC works awesome.

Thanks!

Hi @markusbuchholz -
The GPS is required for the BlueBoat to navigate in Auto, Loiter, or Guided modes…
DVL could theoretically work, but our integrations for it are currently intended for ArduSub and not ArduRover…

MAVLink commands should generally be compatible across vehicle types, but different vehicles don’t necessarily share the same parameters, and some features are implemented for one vehicle without being implemented for others.

From a quick look it seems like the VISION_* MAVLink messages which we use for DVL functionality are handled in ArduPilot’s common functionality, together with the SET_GPS_GLOBAL_ORIGIN message (which is required for localising and initialising a position tracker that’s not receiving GPS inputs), so I expect it should be possible to get a DVL working for any recent enough vehicle firmwares.

Rover also seems to have visual odometry parameters, and EKF source selection parameters, so if you configure it to make use of the external navigation inputs for its horizontal position then I expect it’s likely it would work, but as @tony-white mentioned our current integrations have been designed around and predominantly tested with ArduSub, so it’s possible there are slightly different requirements or configuration for a Rover-based system.

Thanks to @tony-white and @EliotBR for your time, support and inputs.

I was able to configure the DVL with the BlueBoat, but now we encountered some technical issues with the sensor. Therefore, we will use a different approach in our lab (GPS repeater or motion cameras)

The mission using the QGC can be set up out of the box (we tested it at sea). The performance of the BlueBoat is impressive.

We have developed the ROS 2 interface, so the most important thing now is to run ROS 2. Currently, we are looking for a controller that can withstand environmental disturbances and follow the computed path.

Anyway, I will test the approach presented in this post.

Thanks!

Regards,
Markus

1 Like