This site requires JavaScript, please enable it in your browser!
Greenfoot back
Greenfootfan1
Greenfootfan1 wrote ...

2016/3/12

Need help! (Robot Arm)

Greenfootfan1 Greenfootfan1

2016/3/12

#
Hi Guys, I am very new to coding. I do it since half a year at school. First of all I want to say I am sorry for my bad englisch. Our current project is to do a Robot Arm with an upper arm a forearm and a hand. Wie should be able to control parts of the arm (for example just the upper arm) and the other parts of the arm should adjust their position and rotation to the current position of the joint automatically. At the moment I struggle at one main problem. I draw the arm with Greenfoot Image so i have several different objects. I need to rotate and move a certain object and not all of them like setLocation() or setRotation() do. Has anyone an idea how to do that? I hope you understand my problem. Thanks in advance! Samuel
danpost danpost

2016/3/12

#
My Viral Spiral scenario uses connected arms for drawing. Each one is controlled independent of the others. The source is included; so, you can download the scenario and take a look at how I did this.
Greenfootfan1 Greenfootfan1

2016/3/14

#
Thanks a lot for your help! I thought that your Project is really similar to mine so I for a first test I tried to modify int speed in a way which allowes me to Control the arms with Inputs by the Keyboard. But I didn't have much success. I figured out that you save an independent int speed for each arm. For my Robot arm I would need to find some way to change the int speed variable by Inputs via the Keyboard. Could you or anybody else please help me doing that? Thanks in advance! Samuel
danpost danpost

2016/3/14

#
I would label or number your arms (not necessarily visually, but alphabetically, or numerically) in the order of connection. Then make use of the keys representing those labels in combination with another key to represent the direction of the change in speed (increasing or decreasing). One of the shift keys (or you could employ both where either one will change the direction) would be a fair choice.
danpost danpost

2016/3/14

#
Another option would be to have a slider or similar object for changing the speeds of each arm. I have a Bar actor class with a MseActBar subclass (see my Support collection) that creates a bar object that visually displays a value within a range of values whose value can be changed by mouse presses and clicks on it. I also have many examples of their use in my uploaded scenarios.
Greenfootfan1 Greenfootfan1

2016/3/14

#
Thanks for your tips! I finally managed to do it! Thanks a lot!
You need to login to post a reply.