Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7880679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:12:04+00:00 2026-06-03T04:12:04+00:00

I am trying to understand a sample code in Webots (robot simulation program). I

  • 0

I am trying to understand a sample code in Webots (robot simulation program).

I have faced this code :

Servo rightShoulderPitch = getServo("RShoulderPitch");
rightShoulderPitch.setPosition(1.5);

I do not understand what is meat by the first line. It look like that “rightShoulderPitch” is an object of Servo class but it is not created as usual and how ‘getServo’ (i think it is a method) comes here .

This class’s header is, if it helps:

public class FieldPlayer extends Robot {

Also it has description by the company in the reference manual, but I could not understand what they mean. It can be found here search for getservo.

— RShoulderPitch: is the name of the shoulder of the robot

I will appriceite help very much.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T04:12:05+00:00Added an answer on June 3, 2026 at 4:12 am

    To complement Jon’s excellent answer, I’ll try to explain you in much more general terms.

    When you want a sandwich, you have two solutions:

    • prepare the sandwich yourself. This would be the equivalent of the code Sandwich s = new Sandwich()
    • go to a snack bar and ask them a sandwich. This would be the equivalent of the code Sandwich s = snackBar.getSandwich("Ham & Cheese").

    In the latter case, it’s the snackBar object’s getSandwich() method which will use the name of the sandwich you want (“Ham & Cheese”) to prepare a sandwich and return it for you. This method will thus probably, internally, call new Sandwich(). But it could also delegate to another object and call, for example: cook.prepareSandwich("Ham & Cheese"). And in this case, it’s the cook object which will call new Sandwich(). Or the snackBar object could also just get a sandwich that has been prepared in advance and stored in some cache: fridge.getSandwich("Ham & Cheese").

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was trying a program to understand the behavior of structure variable, Sample code:
I am trying to understand this simple hashlib code in Python that has been
Trying to understand Ruby a bit better, I ran into this code surfing the
Trying to understand the math of this code snippet. A token is provided which
I'm trying to understand this: http://tcs.uj.edu.pl/~walczak/fibonacci.pdf I have a word created from a concatenation
You can find it here. I'm trying to understand his sample code in order
While trying to evaulate polynomials using Horner's Rule I have a sample code segment
I am trying to understand the code for the mixins posted at this blog
I'm trying to understand why we need all parts of the standard sample code:
I have found some sample code on codeproject that allows for user impersonation. This

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.