LeJOS Chassis object or MovePilot class

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

Moderators: roger, gloomyandy, skoehler

ralfb1105
New User
Posts: 12
Joined: Mon Jan 15, 2018 10:14 am

LeJOS Chassis object or MovePilot class

Postby ralfb1105 » Mon Feb 05, 2018 3:04 pm

Hi,

maybe a stupid question of a LeJOS and Java beginner, but anyway, I hope someone can send me an answer.
I have a two wheeled roboter to play around with the move control command. I have red some of the very good articles here in the forum, but now after maybe reading to much, I'm a little bit confused. I started with the following code (only an extract):

Code: Select all

    static Wheel wheelL = WheeledChassis.modelWheel(left, 43.2).offset(68.5);
    static Wheel wheelR = WheeledChassis.modelWheel(right, 43.2).offset(-68.5);
    static WheeledChassis chassis = new WheeledChassis(new Wheel[] { wheelL, wheelR }, WheeledChassis.TYPE_DIFFERENTIAL);
        static MovePilot pilot = new MovePilot(chassis);

I have used the new pilot object to move forward, an arc or to rotate:

Code: Select all

pilot.forward();
pilot.stop();
pilot.rotate(90);

This works as expected. Afterwards I was thinking on how to control the speed and acceleration and found the following:

Code: Select all

pilot.setLinearSpeed(100);
pilot.setLinearAcceleration(100);

After this I found some articles talking about "setVelocity" from the Chassis. These methods are not available for the pilot object, only for the chassis interface, like:

Code: Select all

chassis.setVelocity(100, 0);

Can someone explain the difference and the intenetion when to use which interface?

Sorry if some of my explanations sounds strange. Thanks in advance for your help!

Regards,
Ralf

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

Re: LeJOS Chassis object or MovePilot class

Postby gloomyandy » Mon Feb 05, 2018 6:58 pm

You can use either, it depends what sort of motion you want. The Chassis is a slightly "lower level" class and allows you to specify motion in terms of linear and rotational velocity, this is very well suited to a robot that wants to use continuous movement (like say a line follower or my explorer robot that used Lidar to navigate with). If you use the MovePilot, this is more suited to traditional "move and stop" motion so you move in a straight line, stop, rotate etc. It all depends what you want to do. The best way is to try both, play around with them, find what works best for you.
leJOS news https://lejosnews.wordpress.com/

ralfb1105
New User
Posts: 12
Joined: Mon Jan 15, 2018 10:14 am

Re: LeJOS Chassis object or MovePilot class

Postby ralfb1105 » Mon Feb 05, 2018 8:32 pm

Thank you very much for the explanation! This helps a lot and I will try out both.

Regards

Ralf


Return to “EV3 Software”

Who is online

Users browsing this forum: No registered users and 2 guests