Kurt's Raspberry Pi (and BeagleBone Black)

Hi,

Good to see you are doing some progress!
As usual I’ve not had time for much lately (been sick, flu).

I’m just wondering, do you have a good tip where to find info about all the linux commands. And where or how do you run the code you are using? Probably stupid q’s…

Using the Arc32 in combination with the PI sounds interesting, almost like the Orion shield…

Thanks for posting your findings. So far I’ve only done the easy part and trying to get familiar with the gui. When running headless do you run the gui too or just the cmd prompt?

Unfortunately ssh cannot show graphics so it’s all cmd prompt. Though I’ve been talking to Kurt about a simple text based ui that will show feedback of all the legs and command values. Maybe use ncurses or something similar.

en.wikipedia.org/wiki/Ncurses

Hey Kurt I’m not sure if I told you in pm but I ordered a usb2ax from seed. Hopefully it’ll be here in a week or so.

Yep have been thinking about ordering one as well. Probably will. But also wondering about rolling your own. That is could maybe use an Arduino Leonardo or an Arduino Micro which has the Atmega328u4 processor which I believe gives us hardware USB plus a hardware serial port. So could plug plug the USB into the Pi and then connect D0/D1 to each other and use the hardware serial port, connect a lead to an Robotis cable, and connect the other two wires to the + and - of the Lipo (plus the minus should go bck to processor as well). Then Simply plug the plug of the cable into a 4 connection hub… Or something like that…

Zenta: yep would be sort-of like the Orion, although not sure if it would be compatible with the Orion Servos. Just Skyped with Nathan and he says that the Arc32 does have support for the Orion Servos, so may try this as it would be fun to try enabling the feedback and seeing if it works.

As for the command line interface I am very rusty on it. But I am limping along:
As for finding information, I do a lot of internet searches. I also look at the man pages…
On example web site that I have searched a lot is: linux.die.net/man/

On the Pi you can use the “man” command to get manual pages as well. Also if you know a command, most of them allow you to find out more about the command by typing in the argument --help
sometimes where you add the --help
changes what type of help you get.
For example: udevadm --help
Will probably just tell you about the different sub commands that there is, which include info
But typeing: udevadm info --help
Will now tell you different options you have for info.

Also you can type: help
at the command prompt and get an idea of the built-in commands. But does not include everything like: ls
Likewise: man bash
Will give you more details about the bash shell (The default command prompt shell is bash).

Some of the commands I use a lot include:
ls : Lists the contents of a directory (or a file pattern, like: "ls .h" will list all header files. There are several options I use like -l
cd : Change Directory. It is relative to where you are currently unless you give some absolute location to go to. Examples:
cd ~ : Takes you back to your home directory
cd Desktop : changes to the sub directory Desktop (assuming there is one). Also you can sometimes get away with cd D

cd /dev : changes to the absolute location /dev

cp : copy files

mv: Move files (also used to rename a file

rm: Remove files

pwd: Print working directory

grep: Used to search files for stuff

sudo: used to run a command as the supervisor. Needed for some commands or to write to certain locations, examples:
sudo shutdown -r now : tells the system to a shutdown with a restart and do it now. Substitute -h for -r does a halt
sudo cp 99-usb-serial.rules /etc/udev/rules.d

Got to go, Hope that helps.
Kurt

Another tip is auto complete. For example:

I can start typing a command and hit Tab to have it finish. For example my project directory is called “Charlotte” so I can type ‘cd Ch’ and it will auto complete the command ‘cd Charlotte’ for me. Less typing… It works for pretty much anything. commands…file names… etc.

It won’t work of course if there is two directories with the first two letters ‘Ch’ but…
For commands it will list everything in it’s path that matches…

Good Tip!

I ordered the UBEC you mentioned. May order the USB2Dynamixel or the AX12 one from Seeedstudio. But I was also wondering about going a different route and get one of these: robotshop.com/productinfo.as … lang=en-US
Then I could try using it with an Arduino. Probably could not use directly with the Pi, but could level shift, with something like: sparkfun.com/products/8745? (Assuming it comes back in stock)

Kurt

Good find! I didn’t see that.

So I went ahead and ordered one of them from Robotshop. But as I said I will probably start off with SSC-32 support as that is what I have a lot of. Although I am tempted with Arc32 as this allows for two different directions (Lynxmotion robots with Hitec servos), Orion Robots with their servos with feedback capabilities.

Kurt

So I used your persistent device naming idea above for both my XBee and the usb2dynamixel. It works great! I had to update the Dynamixel SDK to know to look for it via the link but other than that it was smooth. The initialize function is a bit simpler now. I’m back to working on my sync write packet formation. I can successfully write a packet to the dynamixel bus though I seem to have a issue. The servos move to their location but any subsequent packet is ignored. Print statements right below the call show the goalPos is changing though the servos don’t respond. .Kurt I might need to get your advice on it. I have guests coming over tonight but I’ll try and pm you the packet code I’m working on and a link to the SDK. Maybe another set of eyes on it will see what I’m doing wrong.

As I mentioned in mail, could be something about the timings. Would help to see what is actually output and received…

Product Plug: If it were me I would use one of my Logic Analyzers (www.saleae.com) to do this :stuck_out_tongue:

But as a minimum it would be good to see the exact sequence of bytes output. Maybe checksum is wrong? …

Kurt

I’ll try and post the output sometime this weekend so you can take a look.

Hi Kevin and others…

Been playing around with the code some more. As I mentioned, I have a Beta SSC-32 (with USB) inside my T-Hex robot. So I unplugged the Botboarduino that was connected to it and ran a longer USB cable from the USB hub connected to the Pi, then I configured my Phoenix program on the Pi for T-Hex and ported SSC-32 code over.

I created a WrapperSerial class that I can pass in File Name like “/dev/ttySSC-32” to and it will create an Arduino Serial like class for it, so I can help minimize my changes to the code. I also added special code to this class that I can create an instance, that cooresponds to stdin/stdout, so I can do debug output… (Still more work to do on the input here).

Yesterday the code just hung and nothing output to the SSC-32 (Used Logic Analyzer to verify). But found that when I exited the program lots of stuff output to the SSC-32. Figured out my code enabled CTS/RTS which the SSC-32 does not support. When I turned this off, the T-Hex now stands up when I turn the Commander on :smiley:. Need to do some more UI work to figure out what I was doing to set the robot height… Also next up may be to port over the DIY XBee code so I can use one of my remotes instead…

Also want to do some cleanup, like the XBee code is doing it’s own stream stuff and can probably be converted to my wrapper code.

In case anyone wishes to see the WIP…

Kurt
RPI - Phoenix WIP.zip (75 KB)

That’s great! Hopefully I can get sometime tonight to figure out my packet problem. Mine stands up as well but just sits there since it won’t accept another packet. :frowning: I wish I had a logic analyzer like you mentioned… Hopefully there is something simple I’ve just missed. I added in the error reporting code from the SDK last night but is was getting late so I didn’t get the bot setup to test. It should tell me what’s going on. Check out what it can report.

Failed transmit instruction packet
Incorrect instruction packet
Failed get status packet from device
Now recieving status packet
There is no status packet
Incorrect status packet
Out of range error
Checksum error
Overload error
Instruction code error
Angle limit error
Input voltage error

I should know pretty quickly with the above. :stuck_out_tongue:

Also Seeed shipped my usb2ax this past week. So hopefully it’ll be here in a couple of weeks.

I now have a version of the DIYXBee stuff ported over and running. The makefile can create two different exes. One for running the Commander and the other to run the DIYXBee stuff.

Was running into issues with XBee timing out and figured out my millis() method was not working.

I updated the zip file with the updated stuff in the previous post.
Kurt

Hello All

I have been thinking for doing the same with my Ch3-r and raspberry pi, i have also been thinking of using a Wi-Fi dongle to control it from my android smart phone or tab
How are you controlling the ssc-32 through the pi to make servo outputs?

Any help is appreciated,

Hi CodeMaster,

Currently I am using a Beta SSC-32 board as talked about in the topic: viewtopic.php?f=2&t=8296
Nice board, but not sure when this board will actually be released, the firmware on mine is incomplete, but at least does all of the group moves and the like. Does not support things like, binary commands, GP sequencer… So currently I have it connected to my RPI by a long USB cable that plugs into the USB powered hub… I will be changing this soon.

You can emulate this on standard USB boards, by using some USB to serial break out board, I know sparkfun sells some and likewise robotshop.com sells some. You can then wire up the TX/RX/GND to the TTL inputs of the SSC-32. You can probably also wire in the +5v to run the logic of the SSC-32 as well. I believe there was a posting about this awhile ago.

Note: the RPI does have a USART that is available, however all IO pins are 3.3v and the SSC-32 is 5v.
Some options that should work for the either version of the SSC-32 boards include:

  1. Wire up some simple resister divider that goes between the RPI rx pin and the SSC-32 tx pin. I am assuming that the RPI output voltage will be high enough for the SSC-32.

  2. Use a IO voltage converter. Example: sparkfun.com/products/8745 (I will probably order myself a few of these)

  3. Connect the RPI up to another board that does the conversion or the like. Example: web4robot.com/PiPlusBoard.html
    Mine just arrived on Friday. Have not done anything with it. This board gives me several options:
    a) Use the USART from the RPI (through it’s voltage converter).
    b) Connect the SSC-32 up to the ATmega328P on this board and develop an Arduino sketch that runs as a slave to the RPI…

  4. Could probably hook up some form of BlueTooth between them. I am pretty sure I have seen tutorials on how to hook up the SSC-32 to BT, but don’t know Linux enough to be able to know how/if you can configure a BT dongle to create a Comm port from it

Hope that helps. Not sure which approach I will take. Maybe I will have to order a 2nd one to try a couple of different ways.
Kurt

Alright! Mine is moving now! I figured out the packet problem. I wasn’t waiting long enough for the status packet.

Some of the angles are slightly different from the Ardunio results. I’m assuming that’s because I’m no longer using the lookup tables.

So Kurt this is interesting. My buttons don’t seem to keep their value. Lets say I have him stand up. On the next loop it sits back down. I haven’t updated anything since your first commander post. Have you changed anything since then?

Not sure, probably need to debug… I was noticing some stuff not working properly, but then figured out with my DIY stuff that my millis function was not properly working, so I fixed that and it helped the DIY. Have not checked back with the Commander Remote since then.

Kurt

No worries. Just threw it out there to see if anything popped up in your mind. I’ll look closer tonight.