# Mavgen.py to translate, but how?

**URL:** <https://discuss.bluerobotics.com/t/mavgen-py-to-translate-but-how/2126>\
**Category:** Blue Robotics Software\
**Created:** [February 6, 2018, 10:30am UTC](https://discuss.bluerobotics.com/t/mavgen-py-to-translate-but-how/2126 "2018-02-06T10:30:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![swagsquad](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@swagsquad](https://discuss.bluerobotics.com/u/swagsquad)\
**Post date:** [February 6, 2018, 10:30am UTC](https://discuss.bluerobotics.com/t/mavgen-py-to-translate-but-how/2126/1 "2018-02-06T10:30:40Z")

</div>

I am trying to connect to the Pixhawk from the Raspberry Pi, but when i use the command:

sudo -s  
mavproxy.py --master=/dev/ttyACM0 --aircraft plane

Then i get a lot of random characters as shown in the picture. I read that you had to use the mavgen.py to use the data of random characters, but how do I do that?

 ![blueROV_Error2](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/3/37d007609952de0d306c45354dc623cdb3549b8e.PNG)

---

<div class="post-metadata">

**Author:** ![patrickelectric](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/patrickelectric/32/2162_2.png) [@patrickelectric](https://discuss.bluerobotics.com/u/patrickelectric)\
**Post date:** [February 6, 2018, 12:24pm UTC](https://discuss.bluerobotics.com/t/mavgen-py-to-translate-but-how/2126/2 "2018-02-06T12:24:12Z")

</div>

> [@swagsquad](#):
>
> Then i get a lot of random characters as shown in the picture.

You are receiving this _random characters_ because a second process is using the serial port, probably is the companion mavproxy that creates a bridge between /dev/ACM0 to udp:192.168.2.1:14550 for QGC.

> [@swagsquad](#):
>
> I read that you had to use the mavgen.py to use the data of random characters, but how do I do that?

If you want to get information from the mavlink protocol, you can use the QGC .tlog files, usually they are in `Documents/QGroundControl/Telemetry`.  
An example of how to use the .tlog files to get an accessible information:

```auto
mavlogdump.py 2018-01-02\ 22-48-02.tlog --format csv --types ATTITUDE 

```

For any further questions check the [mavproxy](https://gitter.im/ArduPilot/MAVProxy) and [pymavlink](https://gitter.im/ArduPilot/pymavlink) gitter channels.

---

<div class="post-metadata">

**Author:** ![swagsquad](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@swagsquad](https://discuss.bluerobotics.com/u/swagsquad)\
**Post date:** [February 6, 2018, 12:31pm UTC](https://discuss.bluerobotics.com/t/mavgen-py-to-translate-but-how/2126/3 "2018-02-06T12:31:50Z")

</div>

It is because we want to be able to write commands to the blueROV2 from the command line i raspberry Pi and then write our own controller for the ROV.

---

<div class="post-metadata">

**Author:** ![patrickelectric](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/patrickelectric/32/2162_2.png) [@patrickelectric](https://discuss.bluerobotics.com/u/patrickelectric)\
**Post date:** [February 6, 2018, 12:43pm UTC](https://discuss.bluerobotics.com/t/mavgen-py-to-translate-but-how/2126/4 "2018-02-06T12:43:23Z")

</div>

> [@swagsquad](#):
>
> It is because we want to be able to write commands to the blueROV2 from the command line i raspberry Pi and then write our own controller for the ROV.

You can search in our forum a series of related questions about this.

> [@\[Autonomous BlueROV2\] MavLink/Ardusub help](http://discuss.bluerobotics.com/t/autonomous-bluerov2-mavlink-ardusub-help/1761):
>
> Hi! I am starting a project where i will need to automatize a BlueROV2. For that i need to send basic controller commands via a script, for example up or down, and receive sensor information on the same script. Can anyone tell me where is the best place to start? I am a bit lost in the ardusub/mavlink/qgroundcontrol documentation! Thanks!

> [@Sending MAVProxy messages from a python program?](http://discuss.bluerobotics.com/t/sending-mavproxy-messages-from-a-python-program/1515):
>
> So I can send commands to my ROV from the MAVProxy command line on my topside computer… Can I send commands to this link from a python program rather than from the command line? The hope is to send a sequence of commands like arming the vehicle, loading WPs, changing the flight mode, etc. Thanks!

and many others 😉

Try to [search in our forum](http://discuss.bluerobotics.com/search?expanded=true&q=pymavlink), probably you’ll be able to find your answer and a lot of interesting information !

---

<div class="post-metadata">

**Author:** ![swagsquad](https://avatars.discourse-cdn.com/v4/letter/s/e47774/32.png) [@swagsquad](https://discuss.bluerobotics.com/u/swagsquad)\
**Post date:** [February 6, 2018, 1:37pm UTC](https://discuss.bluerobotics.com/t/mavgen-py-to-translate-but-how/2126/5 "2018-02-06T13:37:56Z")

</div>

To test it out, i tried this code: [Sending MAVProxy messages from a python program? - #2 by jwalser](http://discuss.bluerobotics.com/t/sending-mavproxy-messages-from-a-python-program/1515/2)

I saved the file on the Raspberry and run it with the python command, but we get this error.

 ![blueROV_Error3](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/8/89ab363a5f2cc000bfe577a79bf37f7e375b1a07.PNG)

---

<div class="post-metadata">

**Author:** ![jwalser](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/jwalser/32/2234_2.png) [@jwalser](https://discuss.bluerobotics.com/u/jwalser)\
**Post date:** [February 6, 2018, 3:00pm UTC](https://discuss.bluerobotics.com/t/mavgen-py-to-translate-but-how/2126/6 "2018-02-06T15:00:10Z")

</div>

The error is telling you what the problem is.

This program is designed to run on the surface computer. The ip address that it connects to is not the same as the ip on the Pi, that is the problem.

You need to change it to `mavutil.mavlink_connection('/dev/serial/by-id/usb-3D_Robotics_PX4_FMU_v2.x_0-if00')`. Remember that you need to disable the existing process that is talking to the pixhawk: `screen -XS mavproxy quit`.
