ROSBRIDGE JAVASCRIPT
One component of rosbridge is a javascript library. The library makes it easier to post topics and messages in the ROS environment. I began to work on the javascript part of the project before I actually had the turtlebot robot at all. I'm not entirely comfortable with javascript, so the process was challenging for me.
BACKGROUND
The first thing I did was to create the appengine project, as suggested by the google links here and here. I downloaded the python google appengine management package. This package has 'appcfg.py' in it, which is an important python file that uploads your appengine project to the web. (You can get that here.) Then I downloaded the sample hangout project, which I would use as a template in for my project. This sample file can be found here.
Before deploying I edited my app.yaml file. Then I began editing the files in the 'static' sub directory. During this process I deployed my extension several times to see that it was working. I began editing the html and javascript files that came with the sample project.
MISTAKE
Here is where I first used the rosbridge javascript library. Without thinking I included that library in the html using 'script' tags. Then I went back and edited my javascript file. I included the file I had written in the html file, with the assumption that it would be able to reference the rosbridge library that had already been included.
Here's the point. I didn't know enough javascript and html to know that I would have to do more than just include the two files in the same html file. What I had to do was first reference the javascript rosbridge library in the top of the file, and then copy and paste the text from my personal javascript library into the html file - between script tags - in a position below the rosbridge reference. This was something of a revelation to me, and only after doing that did my use of the rosbridge library begin to work.
No comments:
Post a Comment