# Thread: Semi-Scratch Built HROS1 Inspiratron (baymax vs .001)

1. ## Re: Semi-Scratch Built HROS1 Inspiratron (baymax vs .001)

Wow! Thanks man. I'll try that first thing tomorrow!

2. T-1000
Join Date
Feb 2009
Posts
2,318
Images
2
Rep Power
137

## Re: Semi-Scratch Built HROS1 Inspiratron (baymax vs .001)

Originally Posted by r3n33
Oh there is a bug with PS3 demo where it uses 100% cpu due to a while loop with no delay in processing. Just before line 206 in ps3_demo/main.cpp add
Code:
usleep( 10000 );
Hopefully that helps. The other thing I'm thinking it sounds like is a lack of comms between the RPi2 and the CM730.
Yah - I forgot about that one. Earlier when I rewrote the PS3 code base as to not require running as the root, I put the delay into the check controller code instead of in main, but same difference.

If you want to take it look, it is up in my Use-my-joystick-controller branch of my fork... My code also works like the ROS joystick code that if it loses the joystick object it will try to reopen it. Likewise it does not require the object to be created before the program runs... I also like I can simply rerun the test program and not have to kill and restart the controller code. Warning - I have not yet tested it on the Edison.

3. ## Re: Semi-Scratch Built HROS1 Inspiratron (baymax vs .001)

so I want to edit the CPP file but I'm not really sure what I am doing... so what I tried was from the command line going into the project folder and typing edit main.cpp. so then a whole bunch of code comes up and that is about where I am lost. Really I need a code editing program or to copy the files off of the robot to edit them on my pc. I could do that in about 10 seconds using the code editing software I use on my computer, but in Linux I am completely lost. Think of me as the end user from hell. :-)

4. T-1000
Join Date
Feb 2009
Posts
2,318
Images
2
Rep Power
137

## Re: Semi-Scratch Built HROS1 Inspiratron (baymax vs .001)

A couple of options here:
1) Setup to use Putty (or now I am using Kitty) and WinSCP. You can connect up to your RPI with WinSCP, double click on the file which will upload it to your pc into a text editor (you can setup which one), where you can make the changes and when you do a save, winscp will download it back to the RPI2...

2) Use a text editor on the RPi2. I often use the old vi program (or vim), but this is not the most obvious editor to figure out how to use. But can be done by: entering commands like:
Code:
:206
which will move you to line 206.
You can then use the arrow keys to move around. To insert or append text hit either the i or the a key. You can then still move around using arrow keys and also type in new text, delete old text...
Once you are done entering the text, hit the Esc key which gets you out of text insert mode.
Then to save the stuff back out enter
Code:
:w
To exit, type:
Code:
:x
...

There is also another editor often built in, which is a little easier to use called nano
Don't know if it comes pre installed or not, but if not can install using: sudo apt-get install nano

There are other graphic editors as well, for example I have used geany before likewise gedit.

Kurt

5. ## Re: Semi-Scratch Built HROS1 Inspiratron (baymax vs .001)

Ok...so now I am using winSCP. I can navigate to the file, open it, and edit it...but when I try to save it I get an error code 3 insufficient permissions... I can't see a way to sudo save the file, and I don't want to screw anything up.

6. T-1000
Join Date
Feb 2009
Posts
2,318
Images
2
Rep Power
137

## Re: Semi-Scratch Built HROS1 Inspiratron (baymax vs .001)

It may depend on which user id you are using to login to the PI and if you enter a password... When I winscp to an RPI, I will log in with userid pi and the password (raspberry), I will often login with the check box that says something like keep me loged in, or the like. Otherwise when you do a save, it will then put up another prompt that asks for password.

But this depends on things like who is the owner of the files... For example on my Pi, if you do an ls -l you will see:
Code:
[email protected] ~/HROS1-Framework/Linux/project/ps3_demo $ls -l total 940 drwxr-xr-x 2 pi pi 4096 May 20 06:19 action_scripts -rwxr-xr-x 1 pi pi 734565 Apr 28 11:14 demo -rw-r--r-- 1 pi pi 9194 Apr 21 09:53 main.cpp -rw-r--r-- 1 pi pi 78128 Apr 28 11:14 main.o -rw-r--r-- 1 pi pi 921 Apr 21 09:53 Makefile -rwxr-xr-x 1 pi pi 439 Apr 25 08:22 rc.local drwxr-xr-x 2 pi pi 4096 Aug 6 19:49 sixpair -rwxr-xr-x 1 pi pi 87 May 20 06:19 start_edison -rwxr-xr-x 1 pi pi 107 May 20 06:19 start_rpi -rw-r--r-- 1 pi pi 17654 May 20 06:19 StatusCheck.cpp -rw-r--r-- 1 pi pi 1607 May 20 06:19 StatusCheck.h -rw-r--r-- 1 pi pi 79560 Apr 28 11:14 StatusCheck.o So I know that the user pi is the owner of the files. If this is not the case on your robot and you are logging in as user pi, you might try changing the file owner using a putty window. something like: sudo chown pii * I am assuming that the error is on that side and not that your text editor does not have the ability to save the actual files on the PC. By default it saves the files somewhere in your temp directories, example I just ran the editor on my PC to my RPI2 in the HROS1 and the file is saved in: C:\Users\Kurt\AppData\Local\Temp\scp00900\home\pi\ HROS1-Framework-Kurte\Linux\project\ps3_demo There are many people up here who are much better at Linux than I am, so if I missed something obvious, hopefully others can give better suggestions. Kurt 7. ## Re: Semi-Scratch Built HROS1 Inspiratron (baymax vs .001) Not sure if this is the problem and definitely not sure what to do about it. :-( Code: [email protected] ~/HROS1-Framework/Linux/project/ps3_demo$ ls -l
total 880
drwxr-xr-x 2 root root   4096 Aug  6 12:57 action_scripts
-rwxr-xr-x 1 root root 682224 Aug  6 17:29 demo
-rw-r--r-- 1 root root   9194 Aug  6 12:57 main.cpp
-rw-r--r-- 1 root root  78220 Aug  6 17:26 main.o
-rw-r--r-- 1 root root    921 Aug  6 12:57 Makefile
-rwxr-xr-x 1 root root    439 Aug  6 12:57 rc.local
drwxr-xr-x 2 root root   4096 Aug  6 12:57 sixpair
-rwxr-xr-x 1 root root     87 Aug  6 12:57 start_edison
-rwxr-xr-x 1 root root    107 Aug 13 18:15 start_rpi
-rw-r--r-- 1 root root  17654 Aug  6 12:57 StatusCheck.cpp
-rw-r--r-- 1 root root   1607 Aug  6 12:57 StatusCheck.h
-rw-r--r-- 1 root root  71508 Aug  6 17:26 StatusCheck.o
[email protected] ~/HROS1-Framework/Linux/project/ps3_demo \$

8. ## Re: Semi-Scratch Built HROS1 Inspiratron (baymax vs .001)

Ok...thank you all for the help. I got logged in as root, I had to change a few things in order to do that, but then I was able to edit the files no problem using winSCP. Cool little program BTW.

After restarting it still seamed to hang up, but not nearly as fast. I guess this is progress.

DB

9. T-1000
Join Date
Feb 2009
Posts
2,318
Images
2
Rep Power
137

## Re: Semi-Scratch Built HROS1 Inspiratron (baymax vs .001)

If it were me, I would probably change the ownership of all of the files to pi (or other user if you created something other than pi).
Something like:

Code:
cd ~
chown -R pi:pi HROS1-Framework

10. ## Re: Semi-Scratch Built HROS1 Inspiratron (baymax vs .001)

Originally Posted by darkback2
After restarting it still seamed to hang up, but not nearly as fast. I guess this is progress.
Darn! Sorry that wasn't the fix you are most in need of at the moment. If I were you I'd check my wiring at this point. Also I'd ensure there aren't any other processes running on my Pi consuming needed resources ( with a program like top or htop ).

Edit: Also you mentioned after restarting. Does that mean you edited the main.cpp file and restarted without running the make command?

There are currently 1 users browsing this thread. (0 members and 1 guests)