Update MoveController to return angularSpeed

This is where you talk about the EV3 software itself, installation issues, and programming talk.

Moderators: roger, gloomyandy, skoehler

User avatar
esmetaman
Advanced Member
Posts: 358
Joined: Wed Sep 13, 2006 12:16 am
Location: UK, Milton Keynes
Contact:

Update MoveController to return angularSpeed

Postby esmetaman » Sun Jul 09, 2017 8:33 am

Hi Andy/Aswin,

I am developing a new ROS library for LeJOS and I have a doubt about the class MoveController.

The class Navigator is able to return a MoveController but the interface doesn´t return the AngularVelocity.

If the user uses the new Pilot based on Chassis, MovePilot has that support:

Code: Select all

EV3LargeRegulatedMotor b = new EV3LargeRegulatedMotor(MotorPort.A);
EV3LargeRegulatedMotor c = new EV3LargeRegulatedMotor(MotorPort.B);
Wheel wheel1 = WheeledChassis.modelWheel(b, diameter);
Wheel wheel2 = WheeledChassis.modelWheel(c, diameter);
Chassis chassis = new WheeledChassis(new Wheel[] { wheel1, wheel2 }, WheeledChassis.TYPE_DIFFERENTIAL);
MovePilot pilot = new MovePilot(chassis);
pilot.setLinearSpeed(20);
pilot.setAngularSpeed(90);


I think that we could update the interface to return the angularVelocity provided by the classic DifferentialPilot.

This is one Constructor to add support for Navigator usages:

Code: Select all

public OdometryNode(
            final Navigator navigator,
            final String frameId) {
        this.poseProvider = navigator.getPoseProvider();
        navigator.getMoveController().getLinearSpeed();
        //navigator.getMoveController().getAngularSpeed();
        this.frameId = frameId;
    }


Original ROS Node for NXT Brick:
https://sourceforge.net/p/lejos/nxt/cod ... ensor.java

What is your opinion?

Juan Antonio
Juan Antonio Breña Moral
http://www.juanantonio.info/lejos-ebook/
http://ev3dev-lang-java.github.io/#/
https://github.com/jabrena/livingrobots

User avatar
gloomyandy
leJOS Team Member
Posts: 5898
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Update MoveController to return angularSpeed

Postby gloomyandy » Sun Jul 09, 2017 4:55 pm

Firstly I'm not a big fan of the various robotics interfaces so don't expect me to justify them, you really need to talk with Brian, Lawrie and Roger as they designed them.

Secondly from what I understand a MoveController is simply a base interface there are then various actual move controller interfaces such as the ArcMoveController, the RotateMoveController etc. some of these do not support the notion of setting and getting the angular velocity, because it is intended to represent a robot that can not turn on the spot (I think that in the original model designed by Brian/Lawrie/Roger angular speed really only applies to robots that turn on the spot, even though in actual fact it also applies to robots that use say a steering system) . However an object that supports the MoveController interface may actually be an instance of a RotateMoveController which can rotate on the spot and which does support the setting and getting of angular speed. If you look at code in the Navigator class you will see that in various places it tests to see what sort of MoveController it is dealing with. So I don't think given this model that it would be correct to extend MoveController to have the extra methods.

Thirdly I'm not completely sure that even if you have those methods that you should be using them in something like an OdometryNode which I think expects you to provide the actual angular velocity generated in the move operation represented by the node. This is not the same as the values returned my the MoveController (which is simply the target velocity used during a move), the actual angular velocity will depend upon many things including the angular acceleration, the type of move (if it is a straight line then obviously the angular velocity of that move will be zero), what portion of a turn is represented by the node etc. The good news is that it is typically very easy to generate both the linear and angular velocities given a series of Poses (which is typically what you get in leJOS.

As to running ROS on ev3dev is there really any need for Java? I thought that there were already various packages the provided the ability to run a ROS node on the EV3?
leJOS news https://lejosnews.wordpress.com/

User avatar
esmetaman
Advanced Member
Posts: 358
Joined: Wed Sep 13, 2006 12:16 am
Location: UK, Milton Keynes
Contact:

Re: Update MoveController to return angularSpeed

Postby esmetaman » Sun Jul 09, 2017 9:31 pm

Hi Andy,

Yes, I understand that the data about angular and linear speed are static.
How to calculate both values (angular/linear) using 2 poses? Can you explain it, please?
I would like to use the Navigator Object which handle a PoseProvider.

In leJOS and in EV3Dev + some languages exist some examples interconnecting some Nodes with ROS but doesn´t exist a library. We had our own library for NXT. In my case, the interest is the SLAM possibilities with Java.

Take a look a demo from the project Google Cartographer:
https://www.youtube.com/watch?v=DM0dpHLhtX0

maybe if some robot with Java can use some map services at home, the example could be useful. :)

the analysis about the ROS library is described in this issue:
https://github.com/ev3dev-lang-java/ev3 ... issues/343
Feel free to join in the discussion, discuss, etc... I appreciate your comments.

This week, I will install in a physical computer a ROS Kinect with Google Cartographer and I will publish some messages to the topic "scan". In my tests, I am using RPLidar. If you are interesting, you could publish with lidarLite v2/v3, the idea is the same.
https://github.com/ev3dev-lang-java/RPLidar4J

Cheers

Juan Antonio
Juan Antonio Breña Moral
http://www.juanantonio.info/lejos-ebook/
http://ev3dev-lang-java.github.io/#/
https://github.com/jabrena/livingrobots

User avatar
gloomyandy
leJOS Team Member
Posts: 5898
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Update MoveController to return angularSpeed

Postby gloomyandy » Mon Jul 10, 2017 1:26 am

Calculating the linear and angular velocities given two poses and the time stamps between them is pretty simple. For the linear velocity simply calculate the linear straight line distance between the two pose locations (simple vector geometry) and divide that distance by the time delta, similarly the poses contain the angular orientation of the robot, so subtract one from the other to obtain the rotation delta and again divide by the time delta. That is all there is to it. Of course it is not 100% accurate if you try to use this for complex compound moves (ones that combine rotation with linear movement) especially if the time delta is large, but for small time deltas (and hence small movement deltas) it is a close enough approximation. It also works fine for movements that consist of simple rotations or linear moves even with large time deltas.
leJOS news https://lejosnews.wordpress.com/

User avatar
esmetaman
Advanced Member
Posts: 358
Joined: Wed Sep 13, 2006 12:16 am
Location: UK, Milton Keynes
Contact:

Re: Update MoveController to return angularSpeed

Postby esmetaman » Mon Jul 10, 2017 8:05 pm

Hi Andy,

Many thanks for the notes, I think that I understood the concept.
I will code it this week.

Cheers

Juan Antonio
Juan Antonio Breña Moral
http://www.juanantonio.info/lejos-ebook/
http://ev3dev-lang-java.github.io/#/
https://github.com/jabrena/livingrobots


Return to “EV3 Software”

Who is online

Users browsing this forum: No registered users and 1 guest