RobotPy 2014.1 and pynetworktables 2014.1 released

It’s that time of year again! I’ve updated RobotPy with this year’s WPILib updates. Additionally, this year I’ve compiled RobotPy using the GCC 4.8 linux cross-compiler instead of using Wind River. Let me know if you find any problems using this release.

pynetworktables is a python library that allows you to communicate via NetworkTables to your robot or the SmartDashboard. It has been verified on Linux and Windows platforms.

Note that RobotPy 2014.1 has not been ran on a cRio yet, and as such is marked as ‘early availability’. I probably won’t be able to test it until this weekend at the earliest, but I don’t have any reason to think it won’t work.

Github links:

Download links (RobotPy installer and pynetworktables Windows binaries):

I’ve been able to test RobotPy on a cRio running a simple program, and it works.

I’ve tested it, working for me. Thanks, Python is my favorite language.

I tried to compile using python 2.7 and I got this error.

build/temp.linux-armv7l-2.7/sippynetworktablesNetworkTable.cpp:62:14: error: invalid covariant return type for ‘virtual ITable* sipNetworkTable::GetSubTable(std::string)’
ITable * GetSubTable(std::string);
^
In file included from /home/odroid/Robot/robotpy/Packages/wpilib/sip/networktables/NetworkTable.sip:57:0:
/home/odroid/Robot/robotpy/Packages/wpilib/WPILib/networktables/NetworkTable.h:179:16: error: overriding ‘virtual NetworkTable* NetworkTable::GetSubTable(std::string)’
NetworkTable* GetSubTable(std::string key);
^
error: command ‘arm-linux-gnueabihf-gcc’ failed with exit status 1
odroid@odroid2053:~/Robot/pynetworktables$

What version of gcc are you using to compile?

Also, I’m guessing that you may not have checked out the RobotPy source code correctly. You need to (a) checkout the correct branch (2014) and (b) make sure you do your submodule update.

The GetSubtable function on my version of the code is returning a NetworkTable*, not an ITable*.

I did this:

git clone https://github.com/robotpy/robotpy.git robotpy
cd robotpy
git checkout 2014
git submodule init
git submodule update

then I did this

cd …/

git clone https://github.com/robotpy/pynetworktables.git

odroid@odroid2053:~/Robot/pynetworktables$ ROBOTPY="/home/odroid/Robot/robotpy" python setup.py build

Then I get the errors

I am using this:

odroid@odroid2053:~/Robot/pynetworktables$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.8/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: …/src/configure -v --with-pkgversion=‘Ubuntu/Linaro 4.8.1-10ubuntu9’ --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-armhf/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-armhf --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-armhf --with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-werror --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu9)

Interesting. Seems ok. I just compiled it on my linux box with GCC 4.8, and it worked fine (though, with the x64 compiler, not the ARM compiler).

I’m using sip version 4.15.3. What version are you using?

odroid@odroid2053:~/Robot/pynetworktables$ sip -V
4.15.2
odroid@odroid2053:~/Robot/pynetworktables$

Very bizarre. Perhaps try upgrading to 4.15.4? (I’m actually using 4.15.4, now that I look at it). There is a note in the 4.15.3 changelog that they fixed something regarding virtual functions.

Also, what does your sippynetworktables… cpp look like? The class definition looks like this, and yours should be relatively identical:



class sipNetworkTable : public NetworkTable
{
public:
    sipNetworkTable(std::string,NetworkTableProvider&);
    virtual ~sipNetworkTable();

    /*
     * There is a protected method for every virtual method visible from
     * this class.
     */
protected:
    bool IsServer();
    bool IsConnected();
    void RemoveConnectionListener(IRemoteConnectionListener *);
    void AddConnectionListener(IRemoteConnectionListener *,bool);
    void RemoveTableListener(ITableListener *);
    void AddSubTableListener(ITableListener *);
    void AddTableListener(ITableListener *);
    bool GetBoolean(std::string) throw(TableKeyNotDefinedException);
    void PutBoolean(std::string,bool);
    std::string GetString(std::string) throw(TableKeyNotDefinedException);
    void PutString(std::string,std::string);
    double GetNumber(std::string) throw(TableKeyNotDefinedException);
    void PutNumber(std::string,double);
    void PutValue(std::string,ComplexData&);
    bool ContainsSubTable(std::string);
    bool ContainsKey(std::string);
    NetworkTable * GetSubTable(std::string);

public:
    sipSimpleWrapper *sipPySelf;

private:
    sipNetworkTable(const sipNetworkTable &);
    sipNetworkTable &operator = (const sipNetworkTable &);

    char sipPyMethods[17];
};



If yours doesn’t look like that, then your code is out of sync for some reason.

I would have to build SIP from source. This distro only has http://packages.ubuntu.com/saucy/python-sip-dbg. I will get back to you later about the files (as in are the different)

Building sip from source is pretty simple.


<unpack it somewhere>
python configure.py
make
sudo make install

That did the trick. With the latest SIP it is all working now. Thanks!:smiley:

I’ll update the docs, thanks for the feedback!