# Setting up test computer

**URL:** <https://discuss.bluerobotics.com/t/setting-up-test-computer/2493>\
**Category:** Blue Robotics Software\
**Created:** [April 17, 2018, 4:20am UTC](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493 "2018-04-17T04:20:36Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![BigAl](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@BigAl](https://discuss.bluerobotics.com/u/BigAl)\
**Post date:** [April 17, 2018, 4:20am UTC](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493/1 "2018-04-17T04:20:36Z")

</div>

I am trying to set up a test setup primarily to try and learn how Mavlink works.  
I have some ideas I want to try

I have a

- rPi3
- rPi camera
- pixhawk
- no other sensors connected

I have copied the companion s/w on to the rPi and ran setup up.

It doesn’t start automatically on reboot. What files are scripts do I need to add to make this work. In fact I don’t know what scripts to start to run t either

Also can I change the IP address on gGroundControl from 192.168.2.1 is the same as my router and it is a pain fiddling with my network each time

---

<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:** [April 17, 2018, 11:33am UTC](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493/2 "2018-04-17T11:33:09Z")

</div>

Hi Alan,

For now, it’s not possible to install companion manually.

> [@Manual Companion RPi Install?](https://discuss.bluerobotics.com/t/manual-companion-rpi-install/2178):
>
> We would like to use the Simulink/ROS stack available via MathWorks for some controls experiments with our new BlueROV2, and from the Simulink side this is done by using Mathworks’ pre-canned image in the RPi side (some Raspbian version and a ROS Indigo build that works with it). I’d like this to run on the companion RPi, as we are moving towards “cutting the tether”, but I see the standard way of configuring the companion RPi is also via an image. Is there 1) a reasonably straightforward way …

> [@BigAl](#):
>
> It doesn’t start automatically on reboot.

For that, you’ll need to make [.companion.rc](https://github.com/bluerobotics/companion/blob/master/.companion.rc) to start with the system, this will call all necessary companion components.

> [@BigAl](#):
>
> Also can I change the IP address on gGroundControl from 192.168.2.1 is the same as my router and it is a pain fiddling with my network each time

You can use [set\_default\_client\_ip.sh](https://github.com/bluerobotics/companion/blob/master/scripts/set_default_client_ip.sh) (E.g: `./set_default_client_ip.sh 192.168.2.2`) to set the raspberry IP address for ethernet connection. If you are running a Linux in your surface computer, you can use nmap to find the ip while scanning port 22 (E.g: `nmap 192.168.0.1-255 -p 22`).

Can you use the [companion image](http://docs.bluerobotics.com/downloads/#raspberry-pi-images) ?

---

<div class="post-metadata">

**Author:** ![BigAl](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@BigAl](https://discuss.bluerobotics.com/u/BigAl)\
**Post date:** [April 17, 2018, 12:34pm UTC](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493/3 "2018-04-17T12:34:52Z")

</div>

Thanks,

I will try flashing the image onto my rPi. That hopefully will be the easiest solution.

I didn’t know where to find it

---

<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:** [April 17, 2018, 12:42pm UTC](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493/4 "2018-04-17T12:42:02Z")

</div>

> [@patrickelectric](#):
>
> You can use set\_default\_client\_ip.sh (E.g: ./set\_default\_client\_ip.sh 192.168.2.2) to set the raspberry IP address for ethernet connection. If you are running a Linux in your surface computer, you can use nmap to find the ip while scanning port 22 (E.g: nmap 192.168.0.1-255 -p 22).

This script will require a reboot for the new ip to take effect. Also, this function is available in the web ui at [http://192.168.2.2:2770/network](http://192.168.2.2:2770/network).

---

<div class="post-metadata">

**Author:** ![BigAl](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@BigAl](https://discuss.bluerobotics.com/u/BigAl)\
**Post date:** [April 18, 2018, 4:36am UTC](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493/5 "2018-04-18T04:36:16Z")

</div>

Thanks for your help.

I re flashed my rPi and it is working how I intended.

Just one further point.

What port is MavLink streaming its messages ?

I would like to connect to this data stream for further processing and logging of the data. I am writing a photogrammetry application. I am also looking at seeing if I can get a dead reackoning function working using the thruster values and the IMU.

Regards,

Alan

---

<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:** [April 18, 2018, 2:01pm UTC](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493/6 "2018-04-18T14:01:35Z")

</div>

Hi Alan,

You can take a further look in [ardusub software components webpage](https://www.ardusub.com/software/components.html) to understand how the companion system works.  
MAProxy sends the protocol using UDP in 14550.

---

<div class="post-metadata">

**Author:** ![BigAl](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@BigAl](https://discuss.bluerobotics.com/u/BigAl)\
**Post date:** [April 18, 2018, 3:58pm UTC](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493/7 "2018-04-18T15:58:55Z")

</div>

Thanks I’ll have a look.

I am using C and UDP sockets look to be a bit different to TCPIP sockets which I have used in the past.

I can connect as a client on 14550 but can’t receive the data stream.

I’ll do some research

---

<div class="post-metadata">

**Author:** ![BigAl](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@BigAl](https://discuss.bluerobotics.com/u/BigAl)\
**Post date:** [April 19, 2018, 2:23am UTC](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493/8 "2018-04-19T02:23:01Z")

</div>

I think I am missing something.

1. I assume that data is being streamed continuously on port 14550
  - no need to send any commands to the server

2. port 14550 is used by QGroundcontrol.  
I assume only one client can access this at a time.
3. I tried this very simple python code to see if I could connect and see data.  
I could connect (Qgroundcontrol was off) but no data was output.

```auto
import socket
serverAddressPort = ("192.168.2.2", 14550)
bufferSize = 1024
# Create a UDP socket at client side
UDPClientSocket = socket.socket(family=socket.AF_INET, type=socket.SOCK_DGRAM)
msgFromServer = UDPClientSocket.recvfrom(bufferSize)
msg = "Message from Server {}".format(msgFromServer[0])
print(msg)

```

1. I tried finding the connection code in QGroundControl but it is too obtuse to locate.

Any help would be appreciated.

---

<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:** [April 19, 2018, 12:47pm UTC](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493/9 "2018-04-19T12:47:08Z")

</div>

Hi Alan,

You need to specify the server address and port to the socket object, looking in the [socket documentation](https://docs.python.org/2/library/socket.html#socket-objects) you can see the _bind_ function.  
`Bind the socket to address. The socket must not already be bound. (The format of address depends on the address family — see above.)`

---

<div class="post-metadata">

**Author:** ![BigAl](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@BigAl](https://discuss.bluerobotics.com/u/BigAl)\
**Post date:** [April 19, 2018, 2:22pm UTC](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493/10 "2018-04-19T14:22:43Z")

</div>

Ok

I am assuming i connect as a client to the rpi  
Ip 192.168.2.2 port 14550

Or should i be the server (from my pc) and therefore use bind ?

---

<div class="post-metadata">

**Author:** ![BigAl](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@BigAl](https://discuss.bluerobotics.com/u/BigAl)\
**Post date:** [April 19, 2018, 2:25pm UTC](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493/11 "2018-04-19T14:25:45Z")

</div>

I left out a couple of l8nes in the python code where i send a msg to 192.168.2.2 14550 and then listen for a response.

I just sent a hello string but do i need to send a proper mavlink message ?

I assume that data is being continuosly streamed from the rpi

---

<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:** [April 19, 2018, 2:49pm UTC](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493/12 "2018-04-19T14:49:48Z")

</div>

> [@BigAl](#):
>
> Or should i be the server (from my pc) and therefore use bind ?

Yes. The pi is sending data to 192.168.2.1:14550 (default), or whatever else you may have set it to.

To test that the data is coming in with the default setup, you can use the command `nc -ul 192.168.2.1:14550` on your topside machine.

---

<div class="post-metadata">

**Author:** ![BigAl](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@BigAl](https://discuss.bluerobotics.com/u/BigAl)\
**Post date:** [April 19, 2018, 3:21pm UTC](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493/13 "2018-04-19T15:21:03Z")

</div>

Ok

Thanks should be able to work it out now.

I am not using 192.168.2.1 on my pc (my router address). But i will change to test.

Is it possible to set the data stream to another ip ?

---

<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:** [April 19, 2018, 3:23pm UTC](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493/14 "2018-04-19T15:23:48Z")

</div>

Yes.

> [@Setting up test computer](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493/4):
>
> This script will require a reboot for the new ip to take effect. Also, this function is available in the web ui at [http://192.168.2.2:2770/network](http://192.168.2.2:2770/network).

---

<div class="post-metadata">

**Author:** ![BigAl](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@BigAl](https://discuss.bluerobotics.com/u/BigAl)\
**Post date:** [April 20, 2018, 1:49pm UTC](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493/15 "2018-04-20T13:49:45Z")

</div>

Thanks for all your help i have it all working perfectly now

---

<div class="post-metadata">

**Author:** ![BigAl](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@BigAl](https://discuss.bluerobotics.com/u/BigAl)\
**Post date:** [April 22, 2018, 1:18pm UTC](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493/16 "2018-04-22T13:18:08Z")

</div>

Just a quick clarification.

As well as reading streamed data on port 14550. Can I send data back out on the same port ? Is there a script running that listens for data on 14550 ?

I would like to try and stream GPS data (bypass nmea-receiver.py) to the pixhawk directly.

The purpose is to understand the communications between the GCS and the Pixhawk.

To do this I am using two functions.

- mavlink\_msg\_gps\_raw\_int\_pack\_chan(…
- mavlink\_msg\_to\_send\_buffer(…;  
and the write the buffer to the socket.

---

<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:** [April 22, 2018, 2:32pm UTC](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493/17 "2018-04-22T14:32:19Z")

</div>

Hi Alan,

Yes, 14550 is a bidirectional port, mavproxy can read from it.

Now, about the GPS, you can take a look in [gps-position ( **Sending GPS position to ROV** )](https://www.ardusub.com/developers/gps-positioning.html) from ArduSub gitbook. MAVProxy will receive position data from `25100`, you check the example to test it.  
Also, it’s possible to send possition via pymavlink, take a look in [pymavlink ( **Send GPS position** )](https://www.ardusub.com/developers/pymavlink.html) examples of ArduSub gitbook.

---

<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:** [April 22, 2018, 2:34pm UTC](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493/18 "2018-04-22T14:34:54Z")

</div>

GPS\_RAW\_INT is the wrong message for this; this message is only for autopilot feedback/status updates on the current position. The one to use is GPS\_INPUT.

---

<div class="post-metadata">

**Author:** ![BigAl](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@BigAl](https://discuss.bluerobotics.com/u/BigAl)\
**Post date:** [April 23, 2018, 2:47am UTC](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493/19 "2018-04-23T02:47:20Z")

</div>

I have tried sending ‘GPS\_INPUT’ on port 14550 but reading message GLOBAL\_POSITION\_INT which I would assume is the processed EKF solution shows nothing.

I also tried sending on port 25100 but same result.

Is the socket 25100 on the ROV running as server or a client ?

```
		{

```

---

<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:** [April 23, 2018, 3:07am UTC](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493/20 "2018-04-23T03:07:28Z")

</div>

What version of companion do you have? ([http://192.168.2.2:2770/system](http://192.168.2.2:2770/system))

You can see all of the code [here](https://github.com/bluerobotics/companion), this same project is in the home directory on the pi.

More specifically, you can see the code for the _server_ [here](https://github.com/bluerobotics/companion/blob/master/tools/nmea-receiver.py), and modify it too. Maybe add some print statements to see what’s going on.

On a pi console, you can enter `screen -r nmearx` to get back to the process that is started at boot. From there you can exit it, modify the script and just run it again.

[Next page](https://discuss.bluerobotics.com/t/setting-up-test-computer/2493.md?page=2)
