Open alexblack opened 8 years ago
On Mon, 30 May 2016, Alex Black wrote:
Can I kill these processes without any impact?
No. They're there for a reason :-) OTOH, you can probably do without some of the functionality.
- /usr/bin/main.py - Looks like used for smart shot?
Not sure what this does. I do believe it is smart shots, 'though.
- /usr/bin/telem_forwarder - Looks like used for smart shot?
telem_forwarder takes telemetry data from the PixHawk and gives it out to clients - most notably Artoo.
Kill this one if you don't care about being able to fly your Copter....
- /usr/bin/pixrc - when I killed this the drone made a noise and lights flashed... d'oh
Likewise :-)
Peter Barker | Programmer,Sysadmin,Geek. pbarker@barker.dropbear.id.au | You need a bigger hammer. :: It's a hack! Expect underscores! - Nigel Williams
@peterbarker ok, so sounds like I can kill /usr/bin/.main.py
then?
What is Artoo?
Say my goal here is to fly the drone as bare bones as possible, is there anything else I might be able to do without?
telem_forwarder
appears to take 10-12% cpu
PID PPID USER STAT VSZ %VSZ %CPU COMMAND
8213 8199 root S 29900 6% 13% /usr/bin/telem_forwarder
8150 2 root SW 0 0% 7% [kworker/0:2]
7488 1 root S 29968 6% 2% /usr/bin/pixrc
880 1 root S 12624 2% 2% dataflash_logger
Artoo is the internal name for the Solo Controller. The forwarder sends telemetry to the controller.
I've freed up a lot of the CPU from background processes by commenting out these lines in /etc/inittab
and then restarting the solo:
#TOP:345:respawn:proc_top /log/3dr-top.log
#TEMP:345:respawn:log_temp
#DSYN:4:respawn:dataFlashMAVLink-to-artoo.py
#DFL:4:respawn:dataflash_logger
#API:4:respawn:run_shotmanager.sh
Then, before calling dronekit.connect
you need to fire up Mav (which used to be done, along with shot manager, in /usr/bin/run_shotmanager.sh
):
def startMav():
"""Requried if you're not running `/usr/bin/run_shotmanager.sh` on the Solo"""
print "Starting up MAV..."
from dronekit_solo import SoloVehicle
from dronekit.mavlink import MAVConnection
mav_vehicle = dronekit.connect("udpout:127.0.0.1:14560", wait_ready=False, vehicle_class=SoloVehicle, source_system=255, use_native=True, heartbeat_timeout=-1)
out = MAVConnection("udpout:127.0.0.1:14550", source_system=254)
mav_vehicle._handler.pipe(out)
out.start()
print "Sleeping 5s to let MAV start..."
# Not sure if this sleep is needed or not...
time.sleep(5)
print "Started MAV."
This combined with setting my process priority higher:
def setProcessPriority():
"""Set our process priority high so we get more CPU time hopefully"""
import os, psutil
p = psutil.Process(os.getpid())
old = p.nice()
p.nice(-20)
print "Process {} priority set from {} to {}".format(p, old, p.nice())
Has got my process's CPU usage up from ~52% to ~92%.
I'm processing images on the Solo, and realizing that performance is slower than it might be due to background processes using some of the CPU. For example, after killing some processes time to run
cv2.Canny
on an image dropped from 250ms to 150ms.I wrote a python program
cpu.py
to do an infinite loop, and top reports it uses ~52% cpu:Can I kill some of these processes without much impact? I'm flying the drone using
dronekit
, but also using the remote occasionally to abort a flight, or move the drone around manually. Not using the gimbal, or smart shot, or much else./usr/bin/main.py
- Looks like used for smart shot?/usr/bin/telem_forwarder
- Looks like used for smart shot?/usr/bin/pixrc
- when I killed this the drone made a noise and lights flashed... d'ohSample CPU logging: