Community
cancel
Showing results for 
Search instead for 
Did you mean: 
HReha
Beginner
3,311 Views

Intel Aero Drone commands to move motors

I have set up the Intel Aero drone. However there is no instructions on how to move the drone. I have no control over the motors besides the remote control. What is the code for moving the drone?

I am interested in any commands for take-off and landing, as well as lateral and vertical motion.

0 Kudos
23 Replies
idata
Community Manager
235 Views

Hello AcomaGaze,

 

 

Thank you for interest in the Intel® Aero Compute Board.

 

 

The best way to do what you are trying to accomplish is with QGroundControl over WiFi, because it provides full flight control and vehicle setup for PX4 powered vehicles.

 

 

If you go to the Fly View, at the bottom of the view is the Guided Bar, some of the possible options are:

 

• Takeoff

 

• Change altitude

 

• Go to location

 

 

Just make sure you follow all the setup steps, here are the corresponding links:

 

• QGroundControl User Guide

 

https://www.gitbook.com/book/donlakeflyer/qgroundcontrol-user-guide/details

 

• WiFi streaming using QGroundControl

 

https://github.com/intel-aero/meta-intel-aero/wiki/WiFi-Streaming

 

• QGroundControl – Fly View

 

https://donlakeflyer.gitbooks.io/qgroundcontrol-user-guide/content/FlyView/FlyView.html

 

 

I hope you find the previous information useful.

 

 

If you need further assistance, don't hesitate to contact us.

 

 

Regards,

 

Andres V.
idata
Community Manager
235 Views

Hello AcomaGaze,

 

 

I was wondering if you had the chance to check the information provided.

 

 

If you have any other question, don't hesitate to contact us.

 

 

Regards,

 

Andres V.
HReha
Beginner
235 Views

Thank you for your assistance,

I want to install a code for the drone so that it moves based on the parameters of the code rather than manually having to indicate where and when it has to do each action through qgroundcontrol.

I have found this link where it tells the drone how to lift off and drop off using RobotOS, would these commands work?

https://github.com/intel-aero/meta-intel-aero/wiki/Meta-ROS

i.e.:

rosservice call /mavros/set_mode 220 AUTO.TAKEOFF

rosservice call /mavros/set_mode 220 AUTO.RTL

Also if these service calls do work to control the drone, are there other variations of these commands? (i.e. move to a certain GPS coordinate)

Thank you again for your help.

idata
Community Manager
235 Views

Hello AcomaGaze,

 

 

Thank you for the information provided, now I understand better what you are trying to achieve.

 

 

I checked the link provided, but haven't personally tried the Robot Operating System approach. I'll be needing more time to read about it and come up with information that you may find useful.

 

 

I'll contact you through this thread as soon as I have relevant information.

 

 

Thank you for your patience.

 

 

Regards,

 

Andres V.
idata
Community Manager
235 Views

Hello AcomaGaze,

I was reading GitHub's intel-aero software release notes, and noticed that MAVLink Router is a compatible with the Intel RTF Drone (https://github.com/intel-aero/meta-intel-aero/wiki/Software-Release-Notes https://github.com/intel-aero/meta-intel-aero/wiki/Software-Release-Notes).

So I kept searching and found the following documentation that introduces MAVLink:

 

https://software.intel.com/en-us/articles/intel-aero-compute-board-developer-guide-for-setting-up-a-... https://software.intel.com/en-us/articles/intel-aero-compute-board-developer-guide-for-setting-up-a-... _Toc468441671.

I suggest you take a look at the previous document, also, check MAVLink's GitHub for further information and examples.

Besides that, I couldn't find a command-based alternative for controlling the drone.

I hope you find the previous information useful.

Regards,

 

Andres V.
SOpte
New Contributor II
235 Views

Hello All,

If you want to control the drone using commands, check http://ardupilot.org/dev/index.html MAVProxy. I am able to give some commands to drone like changing flight mode.

In addition, have a look on https://github.com/01org/mavlink-router/tree/master/examples Mavlink-routerd examples.

Regards,

Soubhi.

Michael_J_Intel1
Employee
235 Views

I have been attempting control of the Aero through mavproxy, but I must be doing something wrong. I can connect to the controller and detect a heartbeat and see messages just fine.

I am able to send messages like ARM and TAKEOFF, which work: but the drone takes off rapidly in the horizontal dimension (I have it tethered, so it didn't get too far).

So this might help the OP, at least to get to the point of causing the drone to move... but might not be exactly useful as the movement is pretty unpredictable...

Here is the relevant parts of my code (full code attached):

mav = mavutil.mavlink_connection('udpin:' + '127.0.0.1:14550')

mav.wait_heartbeat()

print "Set Speed"

mav.mav.command_long_send(mav.target_system, mav.target_component,

mavutil.mavlink.MAV_CMD_DO_CHANGE_SPEED, 0, 0.5,

0, 0, 0, 0, 0, 0)

print "Set Home"

mav.mav.command_long_send(mav.target_system, mav.target_component,

mavutil.mavlink.MAV_CMD_DO_SET_HOME, 0, 1,

0, 0, 0, 0, 0, 0)

print "Homed"

mav.mav.command_long_send(mav.target_system, mav.target_component,

mavutil.mavlink.MAV_CMD_NAV_GUIDED_ENABLE, 0, 1,

0, 0, 0, 0, 0, 0)

print "Guided Mode Set"

mav.mav.command_long_send(mav.target_system, mav.target_component,

mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM, 0, 1,

0, 0, 0, 0, 0, 0)

print "armed"

time.sleep(10)

print "taking off"

mav.mav.command_long_send(mav.target_system, mav.target_component,

mavutil.mavlink.MAV_CMD_NAV_TAKEOFF, 0, 0,

0, 1, 0, 0, 0, 3)

Any clues what I might be doing wrong? Initially I started with just ARM and TAKEOFF, and added the SPEED, HOME, and GUIDED to attempt to get better control. Only the SPEED seemed to help (in that it moved horizontally at a slower rate).

I did notice when posting this that the MAV_CMD_NAV_TAKEOFF had a '1' set for the 4th variable (I first tried MAV_CMD_NAV_TAKEOFF_LOCAL and that sets the ascending speed -- but that command doesn't seem to be supported). Since that variable is unused, that shouldn't be an issue?

idata
Community Manager
235 Views

Hello intel_jassowski,

 

 

Thank you for sharing that information.

 

 

I'll check your code and I'll contact you through this post as soon as I have relevant results.

 

 

Thank you for your patience.

 

 

Regards,

 

Andres V.
Michael_J_Intel1
Employee
235 Views

It turns out that MAV_CMD_NAV_TAKEOFF uses the longitude and latitude values, and my drone was attempting to fly to 0N, 0W... setting those values to the current lat & lng (i.e.:

  1. mav.mav.command_long_send(mav.target_system, mav.target_component,
  2. mavutil.mavlink.MAV_CMD_NAV_TAKEOFF, 0, 0,
  3. 0, 1, 0, lat, lng, 3)

)

[where lat & lng are floats which represent the current position of the UAV], and the drone will hover in place.

SOpte
New Contributor II
235 Views

intel_jassowski

Hi,

Today I faced the same problem and I have two questions if you can help me.

First, I do not want to depend on the GPS. i.e. I want the drone to go up for one meter and land again. How can I achieve that?

 

Second, when you set 1 for Altitude, Is that mean one meter or what?

Currently I just want to figure out how to tell the drone to go up for specific heigh and go ahead for one meter and land again.

Today I tried a code (which is similar to yours ) and the drone kept going in horizontal line and go away and I was terrified until I dropped it down.

Could you please provide me with commands/parameters to do that?

Thank you

Michael_J_Intel1
Employee
235 Views

Soubhi,

Here's what I've been able to determine:

1) if you are not sending the correct current GPS coordinates for the drone, it will attempt to fly to the ones you supply (i.e. 0, 0 will take the drone somewhere off the coast of Africa).

2) Altitude is in meters, however there is a minimum takeoff altitude which is set as a parameter, and possibly also in the firmware. I have not yet been able to get a controlled takeoff to anything under about 10m, but I'm still looking into that.

3) Without GPS, you'll need to be using some other position feedback mechanism: optical flow, uwb, etc. Otherwise the Aero won't know if it's in the right location. And then, I don't know what MAV command you would use to takeoff without providing latitude and longitude. In looking through the PX4 code, it seems like you could send 'None' for the position coordinates, but then it substitutes the current lon/lat values from home: not sure what happens if no GPS is available. This would probably be a good question to ask on a PX4 site (i.e. How to use takeoff/go-to MAV commands without GPS).

SOpte
New Contributor II
235 Views

intel_jassowski Thank you very much. Your replies are very helpful for me.

Today I tried some commands :

mav.mav.command_long_send(mav.target_system,mav.target_component,mavutil.mavlink.MAV_MODE_GUIDED_ARMED, 0, 0, 0, 0, 0, 0, 0, 0)

print ("Set Home")

mav.mav.command_long_send(mav.target_system, mav.target_component,

mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM, 0, 1,

0, 0, 0, 0, 0, 0)

print ("armed")

time.sleep(3)

mav.mav.command_long_send(mav.target_system, mav.target_component,

mavutil.mavlink.MAV_CMD_NAV_TAKEOFF, 0, 0,

0, 0, 0, 36.0990708, -95.9254266, 2)

time.sleep(5)

mav.mav.command_long_send(mav.target_system, mav.target_component,

mavutil.mavlink.MAV_CMD_NAV_RETURN_TO_LAUNCH, 0, 0,

0, 0, 0, 0, 0, 0);

time.sleep(7)

mav.mav.command_long_send(mav.target_system, mav.target_component,

mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM, 0, 0,

0, 0, 0, 0, 0, 0)

print ("disarmed")

The behavior was strange. I set the altitude to 2 but I went much more higher. I set the mode to RTL but It did not return to launch point.

The commands do not work as they are specified in Ardupilot website and the new OS for the Aero and firmware from Ardupilot are not ready to be downloaded too.

What can I do? I am really lost. I need to do just basic navigation operations (using GPS) but the commands work strangely. I even broke the drone today when I executed the program.

I do not know how I can test my code. When I test it on the simulator, it works totally different from real testing. In addition, many commands are not supported by the simulator.

Thank you.

Michael_J_Intel1
Employee
235 Views

I see the same issue with the TAKEOFF command. There are minimum altitude settings for TAKEOFF in the parameters and hard coded into firmware, but I have not been able to successfully launch to a height of less than 10m or so. I'm still looking into what might be causing this, and I'll update here when I know more.

As for RTL, I have not tried this: I'm just using a LAND command with the original HOME coordinates, and that gets me pretty close to the launch site (within GPS accuracy of a meter or so).

SOpte
New Contributor II
235 Views

intel_jassowski ,

Thank you

Did you try to change the value for this parameter MIS_TAKEOFF_ALT. They say that this is the parameter which is responsible to set the minimum altitude : https://dev.px4.io/en/advanced/parameter_reference.html https://dev.px4.io/en/advanced/parameter_reference.html .

I am not able to test it currently because of the bad weather.

Have you tried to use DroneKit to control the drone or not?

How do you get the current lan & long for the drone? Are there any parameters that give you the current coordinates for the drone ?

Thank you,

Soubhi

Michael_J_Intel1
Employee
235 Views

Soubhi,

I did set the parameter in QGC, but I'm not certain if that controls the same parameter above. It's one thing I plan to check...

I have used DroneKit, and that worked well -- as long as you avoid the simple takeoff command:

vehicle.simple_takeoff(aTargetAltitude)

doesn't have any way to specify lat/lon. Dronekit just sets those to 0. The px4 code interprets 0 as.... well 0. This sends the drone to somewhere off the coast of Africa, where I imagine there is a large pile of drones. :-)

Instead I package up a mavlink command using message_factory and MAV_CMD_NAV_TAKEOFF using the current lat/lon of the drone (you may be able to use None for both lat and lon... reading the code for PX4, it

You can get the current position using something like:

lat=vehicle.location.global_relative_frame.lat

lon=vehicle.location.global_relative_frame.lon

Make sure you implement a message listener to ensure the home position is set first:

home_position_set = False

# Create a message listener for home position fix

@vehicle.on_message('HOME_POSITION')

def position_listener(self, name, home_position):

global home_position_set

home_position_set = True

# wait for a home position lock

while not (home_position_set):

print "Waiting for home position..."

time.sleep(1)

SOpte
New Contributor II
235 Views

intel_jassowski,

Thank you very much for your note in the last comment. It was really helpful for me.

I have a couple of short questions

1- What flight mode do you use? I guess in PX4 there is no Guided flight mode and even it is not supported to set Manual mode in Dronekit so I have to set the manual fight mode using message_factory with with MAV_MODE_MANUAL_ARMED zeros for all parameters or do you advice me to use another flight mode?

2- Do you use simple_goto in dronekit with relativeLocation parameters? How do you navigate the drone in general? I mean if I want the drone to go one meter straight (pitch), What do you think is the best may to achieve that?

Kind Regards,

Soubhi

Michael_J_Intel1
Employee
235 Views

Soubhi,

PX4 does have a guided mode. You can control via companion computer either GUIDED (execute commands in real time as the companion computer sends them) or Mission Mode (execute a predefined series of commands). Either create a series of MAV NAV commands into a mission, upload the mission, and begin the mission (http://python.dronekit.io/examples/mission_basic.html steps here). Or use guided mode as http://python.dronekit.io/examples/guided-set-speed-yaw-demo.html described here. Guided mode will require additional logic to handle the determination of when to send the next command, while mission mode handles that on the PX4.

I haven't yet used simple_goto in dronekit, but I have been using message factory to package up raw NAV commands for position control.

If you want to go one meter straight (along the current heading) you'll need to translate the current heading into either the NED frame (Frame relative to home position) or GLOBAL frame (relative to earth). Both are described in the guided mode link.

SOpte
New Contributor II
235 Views

intel_jassowski,

In flight mode https://dev.px4.io/en/concept/flight_modes.html page in PX4, they do not mention Guided mode in the list. In addition, it does not appear in QgroundController flight modes list and when I set it using MAVproxy I get unkown mode. I also tried these two commands but both do not change the fight mode:

vehicle.mode = VehicleMode("GUIDED")

vehicle.send_mavlink(vehicle.message_factory.command_long_encode(0, mavutil.mavlink.MAV_COMP_ID_SYSTEM_CONTROL

,mavutil.mavlink.MAV_MODE_GUIDED_ARMED, 0, 0, 0, 0, 0, 0, 0, 0))

I guess I will work with Manuel flight mode because I do not have specific way points to use mission.

I had something strange today. I was doing testing to small program but the drone's flight mode was always "Hold". I was observing the changes using QgroundController. I am trying to find explanation for what happened.

Thank you very much.

Michael_J_Intel1
Employee
235 Views

Soubhi,

I find the documentation a bit sparse and sometimes conflicting... so my best interpretation is that Guided mode is referred to in your link as "Offboard". Although that isn't consistent with QGC or Planner which calls that GUIDED.

I use

vehicle._master.mav.command_long_send(vehicle._master.target_system, vehicle._master.target_component,

mavutil.mavlink.MAV_CMD_DO_SET_MODE, 0,

mavMode,

0, 0, 0, 0, 0, 0)

where mavMode = 3 for Guided, 4 for mission (which maybe bypasses the dronekit VehicleMode method).

https://pixhawk.ethz.ch/mavlink/ Here's a link to various modes, but I'm not sure from this where I got "3" to be guided. I must have stumbled across that elsewhere .

--MJ

SOpte
New Contributor II
43 Views

intel_jassowski,

Thank you for your patience and help .

MAV_MODE enumeration (IDs) is in this http://docs.ros.org/jade/api/mavlink/html/include__v0_89_2mavlink__types_8h_source.html link.

I have something strange. The default flight mode is Hold. When I try to change it to Manual, It is still hold (either by code or by QGC).

When I try to set offboard, I get the following message : "set flight mode command temporary rejected" .

Could you please tell me which version of PX4 firmware do you use? I am using the one that come with the latest Aero OS and in the wiki they say "The current release of Intel Aero includes the recommended version for PX4".

Is it possible to upload a short file contains code you have tried it on your own drone. That may help me to figure out where is the problem.?

Regards,

Soubhi.

Reply