Java can't access methods on created robot
This works:
import Myro;
Myro.makeRobot("Finch");
Myro.setLED("front", "#FF0000");
But this does not:
import Myro;
robot = Myro.makeRobot("Finch");
robot.setLED("front", "#FF0000");
ExecutionError: No method in Object has name 'setLED'
Comments (13)
-
reporter -
Is this a new thing? Since I created a new set of ikvm-ed java dll's?
-
reporter Not sure.
-
Shouldn't it be:
import Myro.*; sim = Myro.Simulation(); sim = Myro.makeRobot("SimScribbler", sim); sim.forward(1, 1);
In that case I get a similar error to the one in Graphics:
tried to access class cli.Myro$$$003CdoTogether$$003Ec__DynamicSite1 from class cli.Myro
-
reporter No, this works:
import Myro; Myro.init("sim");
Something has changed in accessing methods of created objects.
-
I get the error with this as well:
java>>>>> Myro.Simulation tried to access class cli.Myro$$$003CdoTogether$$003Ec__DynamicSite1 from class cli.Myro
-
This example still works:
import cli.Gtk.*; window = new Window("Title"); window.Show(); button = new Button("Press me!"); button.Show(); window.Add(button);
-
Did the latest .jar and .dll files fix this?
-
reporter No, I don't think it is related. I think it has to do with Java figuring out the type automatically. For example, this works:
import Myro; Myro.init("sim"); sim = Myro.getSimulation(); Myro.Robot robot = (Myro.Robot)Myro.makeRobot("SimScribbler", sim); robot.forward(1,1);
But robot is supposed to be SimScribbler specific, which it is in Python. I guess a limitation of either Java, or of the interpreter.
I think we can close this as just a limitation of the system.
-
OK. This also works:
import Myro; sim = new Myro.Simulation(); robot = (Myro.Robot)Myro.makeRobot("SimScribbler", sim); robot.forward(1,1);
-
reporter Right. As long as it knows how to cast it. I added Myro.getRobotType("SimScribbler") a while back in case we needed it. Not sure what to do with it in Java though...
-
reporter I don't think anything changed; I think this is how DynamicJava works. It can figure out some types, but not all.
-
reporter - changed status to wontfix
Type in DynamicJava is not resolved as well as it could be.
- Log in to comment
To test without a Finch: