I am writing a program in Processing on Raspberrypi(Raspbian), to import a 3D STL image file. It is working perfectly on Microsoft (windows7) & Linux(Ubuntu) platform but I am struggling to run same program on Raspberrypi (Raspbian) platform.
I am getting below Error at size(600,600,P3D) when I run this program on Raspberrypi...
Coding
import toxi.geom.*;
import toxi.geom.mesh.*;
import toxi.processing.*;
TriangleMesh mesh;
ToxiclibsSupport gfx;
void setup() {
size(600,600,P3D);
mesh=(TriangleMesh)new STLReader().loadBinary(sketchPath("check.stl"),STLReader.TRIANGLEMESH);
gfx=new ToxiclibsSupport(this);
}
void draw() {
background(51);
lights();
translate(width/2,height/2,0);
rotateX(mouseY*0.01);
rotateY(mouseX*0.01);
gfx.origin(new Vec3D(),200);
noStroke();
gfx.mesh(mesh,false,10);
}
Error
java.lang.NoClassDefFoundError: javax/media/opengl/GLException
at processing.opengl.PGraphicsOpenGL.createPGL(PGraphicsOpenGL.java:1744)
at processing.opengl.PGraphicsOpenGL.<init>(PGraphicsOpenGL.java:518)
at processing.opengl.PGraphics3D.<init>(PGraphics3D.java:37)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at processing.core.PApplet.makeGraphics(PApplet.java:1919)
at processing.core.PApplet.size(PApplet.java:1771)
at processing.core.PApplet.size(PApplet.java:1742)
at project5.setup(project5.java:27)
at processing.core.PApplet.handleDraw(PApplet.java:2361)
at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240)
at processing.core.PApplet.run(PApplet.java:2256)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 15 more
The issue with Processing is that currently there is no 3D implementation because Raspberry PI needs an OPENGL_ES renderer.
Currently you can only render in 2D (e.g. size(200,200,JAVA2D);).
There is actually an OPENGL_ES renderer in Processing but it's for the Android mode and it has dependencies on the android SDK. As far as I know, there isn't any Processing OPENGL_ES renderer you can use on Raspberry PI at the moment(if someone knows of one, please let me know). In theory how ever, it should be possible to strip out the android dependencies from the Android PGraphics class, but feels like a risky move (especially if you have a tight deadline).To get started you may want to look EGL in java running on Rasperry Pi.
I would recommend using OpenFrameworks instead in this case, if displaying an STL file is all you need. I've modified an existing STL addon for OpenFramworks and tested it: the performance is great on the Raspberry PI. Although it's c++, the project is inspired by Processing and a lot of the functions will sound very familiar.
Once you setup OpenFramworks you can download ofxSTLModel and compile the example(I've updated it to run on Raspberry PI). Press any key to toggle wireframe view.
Update
Now there is an experimental Raspian image including Processing 3 with 3D support. Check out this thread
Related
i tried to create a new eclipse instance, inorder to register/install my metamodel and to inorder to use the model correctly in the VSP. However I faced an error when I tried to reference the metamodel in the .odesign:
java.lang.reflect.InvocationTargetException
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:443)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:352)
at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:470)
at org.eclipse.ui.internal.progress.ProgressManager$RunnableWithStatus.run(ProgressManager.java:1117)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74)
at org.eclipse.ui.internal.progress.ProgressManager.lambda$27(ProgressManager.java:996)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:236)
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:133)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:6012)
at org.eclipse.ui.internal.progress.ProgressManager.runInUI(ProgressManager.java:996)
at org.eclipse.sirius.editor.properties.sections.description.representationdescription.AddFromRegistryButtonListener.widgetSelected(AddFromRegistryButtonListener.java:77)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5895)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1520)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:5126)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4581)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
Caused by: java.lang.NoClassDefFoundError: gurobi/GRBVar
at autoDesigner1.impl.AutoDesigner1PackageImpl.initializePackageContents(AutoDesigner1PackageImpl.java:1425)
at autoDesigner1.impl.AutoDesigner1PackageImpl.init(AutoDesigner1PackageImpl.java:202)
at autoDesigner1.AutoDesigner1Package.<clinit>(AutoDesigner1Package.java:58)
at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1155)
at java.base/jdk.internal.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:42)
at java.base/jdk.internal.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:186)
at java.base/java.lang.reflect.Field.acquireFieldAccessor(Field.java:1126)
at java.base/java.lang.reflect.Field.getFieldAccessor(Field.java:1107)
at java.base/java.lang.reflect.Field.get(Field.java:419)
at org.eclipse.emf.ecore.plugin.RegistryReader$EPackageDescriptor.getEPackage(RegistryReader.java:304)
at org.eclipse.sirius.editor.properties.sections.description.representationdescription.DescriptionMetamodelsUpdater.getEPackagesFromNsURI(DescriptionMetamodelsUpdater.java:282)
at org.eclipse.sirius.editor.properties.sections.description.representationdescription.AddFromRegistryButtonListener$1.run(AddFromRegistryButtonListener.java:83)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:434)
... 38 more
Caused by: java.lang.ClassNotFoundException: gurobi.GRBVar cannot be found by AutoDesigner1_0.1.0.qualifier
at org.eclipse.osgi.internal.loader.BundleLoader.generateException(BundleLoader.java:529)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:524)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:416)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:168)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)
... 52 more
I think that the referenced gurobi library is the problem. However I already added the jar under classpath and set the environment variables.
The library is also loaded correctly.
I dont know how to solve the problem and would be grateful if someone could help me.
I am new to OMNeT++ and I'm trying to implement a drone network that communicate with each other using direct messages.
I want to visualize my drone network with the 3D visualization in OMNeT using the OsgVisualizer in inet.visualizer.scene package.
In the dronenetwork.ned file, I have used the IntegratedVisualizer and the OsgGeographicCoordinateSystem. Then in the omnetpp.ini file, the map file to be used is defined and so the map loading and mobility of the drones works fine in the 3D visualization of the simulation run.
However, the message transmissions between the drones are not visualized in 3D even though this is properly visualized in the 2D canvas mode.
I tried adding both NetworkNodeOsgVisualizer and NetworkConnectionOsgVisualizer to my drone module as visualization simple modules and also I have defined the drones as a #networkNode and #networkConnectionNode. But it still hasn't been able to visualize the message transmissions.
Any help or hint regarding this would be highly appreciated.
Code used for visualizations in the simple module drone is as follows
import inet.visualizer.scene.NetworkNodeOsgVisualizer;
import inet.visualizer.scene.NetworkConnectionOsgVisualizer;
module drone
{
parameters:
#networkNode;
#networkConnection;
submodules:
networkNodeOsgVisualizer: NetworkNodeOsgVisualizer {
#display("p=207,50");
displayModuleName = true;
visualizationTargetModule = "^.^";
visualizationSubjectModule = "wirelessInterface.^.^";
}
networkConnectionOsgVisualizer : NetworkConnectionOsgVisualizer{
visualizationTargetModule = "^.^";
visualizationSubjectModule = "wirelessInterface.^.^";
displayNetworkConnections = true;
}
Thank you
Message passing and direct message sending visualizations are special cases implemented by the Qtenv automatically for 2D (default) visualization only. You can add custom 2D message visualization (like the one in the aloha example). OMNeT++ does not provide any 3D visualization by default. All the code must be provided by the model (INET in this case). This is also true for any transient visualization. There is an example for this in the osg-earth omnet example where communication between cows are visualized by inflating bubbles.
So, you have to implement your own visualization effect. There is something in INET which is pretty close to what you want: DataLinkOsgVisualizer and PhysicalLinkOsgVisualizer which flashes an arrow if communication on data link or physical layer has occurred. This is not the same as message passing, but close enough. Or you can implement your own animation using these visualizers as a sample.
String filePath = new File("").getAbsolutePath();
DataSource source = new DataSource(filePath + "\\src\\data\\data.arff");
Instances dataset = source.getDataSet();
// set class
dataset.setClassIndex(0);
// build model
**LinearRegression lr = new LinearRegression();**
lr.buildClassifier(dataset);
System.out.println(lr);
Right after LinearRegression instantiation I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError:
no/uib/cipr/matrix/Matrix at
weka_prediction.Main_LinearRegression.main(Main_LinearRegression.java:22)
Caused by: java.lang.ClassNotFoundException: no.uib.cipr.matrix.Matrix
at java.net.URLClassLoader.findClass(Unknown Source) at
java.lang.ClassLoader.loadClass(Unknown Source) at
sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at
java.lang.ClassLoader.loadClass(Unknown Source) ... 1 more
I am using weka 3.8.
any ideas? thanks in advance
There is a problem with loading weka.core. You just need to go to the weka repository and download and add the following jars:
mtj.jar
arpack_combined_all.jar
core.jar
See more details here:
Solved!
instead of 3.8, I am now using 3.6 from here:
http://grepcode.com/project/repo1.maven.org/maven2/nz.ac.waikato.cms.weka/weka-stable/
For anyone who are trying to run Weka as a tool. When you downloaded the weka archive, unzip it, you will find the weka.jar. And then just do what #Kirill Karmazin said in the comment in here. unzip the 3 jars arpack_combined.jar, core.jar and mtj.jar and put them alongside with weka.jar.
Then run java -cp * weka.gui.GUIChooser to run the Weka GUI.
Rather than extracting the MTJ and arpack libraries, simply use Weka's package manager to sort this out for you. It will initialize package management and, if necessary, add these internal jars to its classpath automatically.
You do this by calling the loadPackages method of the weka.core.WekaPackageManager class.
Here is an example:
import weka.core.converters.ConverterUtils.DataSource;
import weka.core.Instances;
import weka.core.WekaPackageManager;
import weka.classifiers.functions.LinearRegression;
public class LR {
public static void main(String[] args) throws Exception {
// load packages and MTJ/arpack libraries (if necessary)
WekaPackageManager.loadPackages(false);
// load dataset
DataSource source = new DataSource(args[0]);
Instances dataset = source.getDataSet();
// set class
dataset.setClassIndex(dataset.numAttributes() - 1);
// build model
LinearRegression lr = new LinearRegression();
lr.buildClassifier(dataset);
System.out.println(lr);
}
}
I am getting started with Unreal Engine 4. I come from Libgdx and I am familiarized using WebSockets clients in my games and NodeJS with 'ws' on the server.
How ever, I can't find information about Websockets and Unreal Engine 4.
I know that given that it is programmed with C++ you can add external static libraries to the unreal project.
Can I use this c++ websocket library?
https://github.com/zaphoyd/websocketpp
Will it run on Windows, Mac and console?
I am not an expert of c++ and static libraries.
Please help, thanks!
You can follow this tutorial on TCP Sockets.
You will need to make some changes on the code, as it doesn't run on UE 4.10 (the tutorial is originally from 2014).
On the .h file define 2 timer handles:
FTimerHandle TimerHandle_Connection;
FTimerHandle TimerHandle_Socket;
On the .cpp file, inside StartTCPReceiver(...) change the line where the timer is set to:
GetWorldTimerManager().SetTimer(TimerHandle_Connection, this, &AYourClass::TCPConnectionListener, 0.01, true);
and on TCPConnectionListener(...) change the line where the timer is set to:
GetWorldTimerManager().ClearTimer(TimerHandle_Connection);//optional, only if you want to stop listening for new connections
GetWorldTimerManager().SetTimer(TimerHandle_Socket, this, &AYourClass::TCPSocketListener, 0.01, true);
(Another option would be to thread these functions instead of having them in timers)
Just in case, if you are new to UE, don't add the code directly on the IDE. Go to the Content Browser > Add New > New C++ Class. You can create a new class that inherits from Actor, and when you want to start to listen to connections, you spawn that Actor.
You can use any websocket or third party asset with unreal engine. You can simply add the headers in your Build.cs file using PrivateIncludePathModuleNames for example (there's also a public include path) and it takes an array of strings where each string is a folder essentially. If you want to add a library (lib) file you can just add it like this:
if (Target.Platform == UnrealTargetPlatform.Win32 ||
Target.Platform == UnrealTargetPlatform.Win64)
{
PublicSystemLibraries.Add("crypt32.lib");
}
You can also add full paths here. If you want to do a delayed load you can just use PublicDelayLoadedDlls.Add("name") <- I may have the syntax wrong on this one but it's easy to google it.
I'm trying to read/load an exported JSON and resources from CocosStudio(this is a tool to generate animations)
But when i try to load or read is seams that the isn't any class or function in order to load this file. I did a web research and all i found were deprecated code or external libraries etc..
thinks like:
auto animation animation = extension::ccSkeletonAnimation::createWithFile("FILE.JSON","FILE.ATLAS");
animation->setPosition((x+y));
animation->setAnimation("a",true);
this->addChild(animation,0);
The code above is using an external tool similar to "cocosStudio", called "Spin"
Is it any that can provide some guidance on this...? or the proper class to set an animation a JSON file?
The cocos2dx version is 3.1
Thanks in advance!
Best regards!
I'm using this code to import animation from cocostudio to visual studio 12
cocostudio::Armature* armature;
ArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("DemoPlayer0.png","DemoPlayer0.plist","DemoPlayer.ExportJson");
armature = Armature::create("DemoPlayer");
armature->setPosition(ccp(visibleSize.width * 0.8,visibleSize.height * 0.5));
armature->getAnimation()->playByIndex(0);
armature->setScale(0.25);
this->addChild(armature);
Or you can check this code in help section of cocostudio.
//async loading export file
CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("Cowboy0.png","Cowboy0.plist","Cowboy.ExportJson");
//Creat armature by name
CCArmature *armature = CCArmature::create("Cowboy");
//play animation by animation index
armature->getAnimation()->playByIndex(0);
//Change Permissions
armature->setScale(0.5f);
//Set the armature position
armature->setPosition(200,300);
//add to the current scene
this->addChild(armature,2)
Good luck !