Total Pageviews

Friday, July 12, 2013

Configure ROS package rosserial on Ubuntu

Some commonly missing step after install arduino IDE is forget to add yourself into "dialout" and "tty" group. You can do so by the following command.

$sudo usermod -a -G tty yourUserName
and
$sudo usermod -a -G dialout yourUserName

To use rosserial, after you have done everything in the rosserial's tutorial and try to complie (or verify) your code you might got an error message like the following :

In file included from /Users/kevin/Documents/Arduino/libraries/ros_lib/ros.h:39,
             from HelloWorld.cpp:6:
  /Users/kevin/Documents/Arduino/libraries/ros_lib/ArduinoHardware.h:38:22: error: WProgram.h: No such file or directory

You fix it by go to the mentioned file, in this case, located at "/Users/kevin/Documents/Arduino/libraries/ros_lib/"

$cd /Users/kevin/Documents/Arduino/libraries/ros_lib/
$gedit ArduinoHardware.h

Replace the line "#include WProgram.h" with the following

  #if defined(ARDUINO) && ARDUINO >= 100
 #include "Arduino.h"
 #else
 #include "WProgram.h"
 #endif

Go back to the IDE and compile the code again, and it should be fine. 

Thursday, July 11, 2013

Setup Canon iRC2380i printer on Linux Ubuntu

Canon-Europe website provide Linux driver for Canon iRC2380i printer. Just download CQue 2.0.5 Linux Driver DEB (32 bits or 64 bits version, depend on your machine) from the link. After download, double-click on the DEB file and Ubuntu Software Center should come up and you can install it from there.

After driver is installed successfully, go to System Settings -> Printing -> Add -> Click on Network Printer and wait for a while. Canon C2380/2550 should be on the list and you are done.


However, SMART need to set up  a department account (department ID and password) to protect the printer from unauthorized users. Unfortunately, the driver doesn’t support department account directly from GUI. The following guide will show how to do just that.


After you install the CQue Linux driver as mentioned above, you should have PPD folder locate at /opt/cel/ppd.

  • In terminal
$cd /opt/cel/ppd
$ls

  • Here you will see a long list of supported drivers, our Canon iRC2380i’s driver is named “cel-irc1028-pcl-en.ppd.gz” we need to unzip (using gzip) and modify it.
still in the /opt/cel/ppd folder
$gzip -d cel-irc1028-pcl-en.ppd.gz

  • Now you should have unziped file named “cel-irc2380-pcl-en.ppd” which we need to modify.
$sudo gedit cel-irc2380-pcl-en.ppd

  • Locate a line similar to (you can use find function (Ctrl+f) in gedit to find this line)
*NickName: "Canon iR C2380/2550 PCL
And modify it to
*NickName: "Canon iR C2380/2550 PCL SMART”

  • And also locate line
*ShortNickName: "Canon iR C2380/2550 PCL"
And modify it to
*ShortNickName: "Canon iR C2380/2550 PCL SMART"

  • Next locate line
*DefaultUserID: None
And modify “None” to your department’s ID, for example
*DefaultUserID: 12345

  • Last Locate line
*DefaultUserPassword: None
And modify “None” to your department’s password, for example
*DefaultUserPassword: 6789

  • You are done! Save the file and exit.

  • Back to System Settings -> Printing you should see the Canon iRC2380i icon there. Right-click -> Properties -> Settings -> Make and Model -> Change -> Choose “Provide PPD file” -> on the sidebar click on “File system” -> opt -> cel -> ppd -> chose the cel-irc2380-pcl-en.ppd we just edited. -> Select option “Use the new PPD … as is”

  • Now you will be back to Printer Properties window, in Settings you should see the Make and Model field is now write “Canon iR C2380/2550 PCL SMART”, which indicate that the printer are now using the PPD file we just edited.

  • Everything’s done … go try to print something.


Reference : XIN.at
Tested on Ubuntu 12.04 on 11 Jul 2013.

Wednesday, July 10, 2013

Fix an error when run apt-get update

I got an error after run an apt-get update recently, the error message look like these

W: Failed to fetch http://ppa.launchpad.net/jonls/redshift-ppa/ubuntu/dists/precise/main/source/Sources  404  Not Found

To fix it you can run the following command

gksu software-properties-gtk

and remove the problematic package (ppa.launchpad.net in this case), and then try apt-get update again.

Tuesday, July 9, 2013

Remove lengthly word from command promtp

There are many kind of script out there,but this is what suite me best. The script limit a command prompt to 30 character, if longer than that its will show only the first 12 and last 15 characters. The "\h" in the last line is added to show a hostname, convenient if you often work on remote machine.

To use, just put the following text in ./bashrc file. 

#--- Custom terminal, cutout lengthly word ---
PROMPT_COMMAND='DIR=`pwd|sed -e "s!$HOME!~!"`; if [ ${#DIR} -gt 30 ]; then CurDir=${DIR:0:12}...${DIR:${#DIR}-15}; else CurDir=$DIR; fi'
PS1='[\h:$CurDir] \$ '

Launch GNOME session from terminal


  • Switch to a second terminal by pressing: ctrl + alt + F2, and provide an current machine login information
  • start a new X-session: 
$xinit -- :1
  • ssh to target machine with -X option
$ssh -X username@targetmachineIP
  • once logged in, start a new gnome-session
$gnome-session

If you want to switch back to your current machine, just press: ctrl + alt +F7