ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Why the increased system usage?

asked 2015-12-10 08:30:31 -0500

aland_t gravatar image

I have a Raspberry Pi B running Raspbian and ROS Groovy with two nodes. The first node controls the Pi camera and publishes the feed which is subscribed to on a separate PC. The second node publishes data received from a custom daughter board that is subscribed to by the PC, and subscribes to data published by the PC and sends that data to the daughter board. The camera streams fine by itself, and the other node operates great by itself. If both nodes are running, the camera is still fine, but the second node never updates data (the PC and daughter board never receive quality data). I plugged the Pi into a monitor for troubleshooting and noticed the green system usage bar is maxed out when running the second node.

I figured the Pi could not handle this robust of a node and decided to upgrade to the Pi 2.

Here's where things get interesting/confusing.

The Pi 2 is running Ubuntu with ROS Indigo. Both nodes start, but now the camera feed lags by 2-3 seconds. I decided to check the system usage for both Pi's and got the following results: Pi B: Pi 2:
PiCameraNode: 5.5-5.8% PiCameraNode: 3.3-4.0%
ServerNode: 87.4-88.9% ServerNode: 122.6-124.0%

Why would the Pi 2 which is significantly more powerful need more resources for the same code? Any ideas as to what could cause this, or how to fix the problem? Any help would be appreciated.

edit retag flag offensive close merge delete

Comments

As noted by Humpelstilzchen, the %CPU is per core so there is no problem with 125%CPU on the Pi2. I was able to decrease the lag of the camera to about 0.5 seconds by adding "gpu_mem=512" to "/boot/config.txt". I will play around with it some more and see how low I can get the lag.

aland_t gravatar image aland_t  ( 2015-12-10 09:55:37 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2015-12-10 09:08:21 -0500

Humpelstilzchen gravatar image

Sorry, didn't got it. You said the Pi1 was to slow for your task, which also seemed to be confirmed by your values: 99%+6%=95% CPU usage, which is way too close to 100%. This indicates that the PI is throwing all its idle time to ServerNode which is still not enough.

The Pi2 on the other hand seem to be fast enough with its multiple cores, it is using 125% = 1,25 CPU cores to handle the node.

edit flag offensive delete link more

Comments

Thanks for the rapid response. I did not realize that %CPU was for one core. Now I just need to solve the camera latency issue.

aland_t gravatar image aland_t  ( 2015-12-10 09:36:17 -0500 )edit
0

answered 2015-12-10 12:38:21 -0500

ahendrix gravatar image

Your description of the ServerNode using a full CPU core is suspicious given that it's only acting as an intermediary between the computer and the daughter card; particularly given that it still uses a full core even when moved to a larger CPU.

You should inspect the code for your ServerNode and make sure that it isn't busy-waiting or otherwise consuming CPU cycles when it's just waiting for events.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-12-10 08:30:31 -0500

Seen: 341 times

Last updated: Dec 10 '15