Question

In: Computer Science

Develop a VPython program creating an animation of your group’s object (a person walking up a...

Develop a VPython program creating an animation of your group’s object (a person walking up a flight up stairs) and cause it to move so that the animation simulates the motion of the object assigned. A .py file

Solutions

Expert Solution

from visual import *
import xlrd

scene2 = display(title='upstairs ', x=0, y=0, width=600, height=600, center=(30,-20,0), background=(0,1,1))
file_loc = "D:\acad\cct.xlsx"
workbook = xlrd.open_workbook(file_loc)
sheet = workbook.sheet_by_index(0)

r = 1.0
rb = 0.5

floor_bottom = box(pos=(30, -39, -15), length=60, height=2, width=30)

Rank = sphere(pos=(27,-36,0), radius=r)

Rknee = sphere(pos=(28.3,-29.1,0), radius=r)
Rhip = sphere(pos=(28.6,-22.6,0), radius=r)

Rshoulder = sphere(pos=(28.15,-16.65,0.75), radius=r)
Relbo = sphere(pos=(28.5,-22,0.75), radius=r)

Rwrist = sphere(pos=(29.7,-26.11,0.75), radius=r)
Lank = sphere(pos=(34,-36,-0.5), radius=r)

Lknee = sphere(pos=(33.5,-28.8,-0.5), radius=r)
Lhip = sphere(pos=(32.17,-21.94,-0.5), radius=r)

Lshoulder = sphere(pos=(33.4,-15.9,-0.75), radius=r)
Lelbo = sphere(pos=(33.6,-20.74,0), radius=r)

Lwrist = sphere(pos=(32.03,-24.2,0.6), radius=r)

bone_Rank_Rknee = cylinder(pos= Rank.pos, axis=Rknee.pos-Rank.pos, radius=rb, color = color.black)
bone_Rhip_Rknee = cylinder(pos= Rknee.pos, axis=Rhip.pos-Rknee.pos, radius=rb, color = color.black)

bone_Rhip_Lhip = cylinder(pos= Rhip.pos, axis=Lhip.pos-Rhip.pos, radius=rb)
bone_Lhip_Lknee = cylinder(pos= Lhip.pos, axis=Lknee.pos-Lhip.pos, radius=rb, color = color.black)

bone_Lank_Lknee = cylinder(pos= Lank.pos, axis=Lknee.pos-Lank.pos, radius=rb, color = color.black)
bone_Lhip_Lshoulder = cylinder(pos= Lhip.pos, axis=Lshoulder.pos-Lhip.pos, radius=rb)

bone_Rhip_Rshoulder = cylinder(pos= Rhip.pos, axis=Rshoulder.pos-Rhip.pos, radius=rb)
bone_Rshoulder_Lshoulder = cylinder(pos= Lshoulder.pos, axis=Rshoulder.pos-Lshoulder.pos, radius=rb)

bone_Lelbo_Lshoulder = cylinder(pos= Lelbo.pos, axis=Lshoulder.pos-Lelbo.pos, radius=rb)
bone_Lelbo_Lwrist = cylinder(pos= Lelbo.pos, axis=Lwrist.pos-Lelbo.pos, radius=rb)

bone_Relbo_Rshoulder = cylinder(pos= Relbo.pos, axis=Rshoulder.pos-Relbo.pos, radius=rb)
bone_Relbo_Rwrist = cylinder(pos= Relbo.pos, axis=Rwrist.pos-Relbo.pos, radius=rb)

Bat = cylinder(pos= Lwrist.pos, axis=Bat_bottom.pos-Lwrist.pos, radius=0.8, color = color.yellow)

LLeg = cylinder(pos= Lank.pos, axis=(1,-1,2), radius=0.8, color = color.red)

RLeg = cylinder(pos= Rank.pos, axis=(1,-1,2), radius=0.8, color = color.red)

while True :
   for i in range( 3, 17,1):
       rate(20)
   if i > 6:

       boll.pos = (sheet.cell_value(i,40), -1*sheet.cell_value(i,41), sheet.cell_value(i,42))
       boll.color = color.green

   Rank.pos = ( sheet.cell_value(i,1), -1*sheet.cell_value(i,2), sheet.cell_value(i,3))
   Rknee.pos = ( sheet.cell_value(i,4), -1*sheet.cell_value(i,5), sheet.cell_value(i,6))
   Rhip.pos = ( sheet.cell_value(i,7), -1*sheet.cell_value(i,8), sheet.cell_value(i,9))
   Rshoulder.pos = ( sheet.cell_value(i,10), -1*sheet.cell_value(i,11), sheet.cell_value(i,12))
   Relbo.pos = ( sheet.cell_value(i,13), -1*sheet.cell_value(i,14), sheet.cell_value(i,15))
   Rwrist.pos = ( sheet.cell_value(i,16), -1*sheet.cell_value(i,17), sheet.cell_value(i,18))

   Lank.pos = ( sheet.cell_value(i,19), -1*sheet.cell_value(i,20), sheet.cell_value(i,21))
   Lknee.pos = ( sheet.cell_value(i,22), -1*sheet.cell_value(i,23), sheet.cell_value(i,24))
   Lhip.pos = ( sheet.cell_value(i,25), -1*sheet.cell_value(i,26), sheet.cell_value(i,27))  
   Lshoulder.pos = ( sheet.cell_value(i,28), -1*sheet.cell_value(i,29), sheet.cell_value(i,30))
   Lelbo.pos = ( sheet.cell_value(i,31), -1*sheet.cell_value(i,32), sheet.cell_value(i,33))
   Lwrist.pos = ( sheet.cell_value(i,34), -1*sheet.cell_value(i,35), sheet.cell_value(i,36))

  

   bone_Rank_Rknee.pos = Rank.pos
   bone_Rank_Rknee.axis = Rknee.pos-Rank.pos

   bone_Rhip_Rknee.pos = Rhip.pos
   bone_Rhip_Rknee.axis = Rknee.pos-Rhip.pos

   bone_Rhip_Lhip.pos = Rhip.pos
   bone_Rhip_Lhip.axis = Lhip.pos-Rhip.pos
  
   bone_Lhip_Lknee.pos = Lhip.pos
   bone_Lhip_Lknee.axis = Lknee.pos-Lhip.pos

   bone_Lank_Lknee.pos = Lank.pos
   bone_Lank_Lknee.axis = Lknee.pos-Lank.pos

   bone_Lhip_Lshoulder.pos = Lhip.pos
   bone_Lhip_Lshoulder.axis = Lshoulder.pos-Lhip.pos

   bone_Rhip_Rshoulder.pos = Rhip.pos
   bone_Rhip_Rshoulder.axis = Rshoulder.pos-Rhip.pos

   bone_Rshoulder_Lshoulder.pos = Lshoulder.pos
   bone_Rshoulder_Lshoulder.axis = Rshoulder.pos-Lshoulder.pos

   bone_Lelbo_Lshoulder.pos = Lelbo.pos
   bone_Lelbo_Lshoulder.axis = Lshoulder.pos- Lelbo.pos

   bone_Lelbo_Lwrist.pos = Lelbo.pos
   bone_Lelbo_Lwrist.axis = Lwrist.pos- Lelbo.pos

   bone_Relbo_Rshoulder.pos = Relbo.pos
   bone_Relbo_Rshoulder.axis = Rshoulder.pos- Relbo.pos

   bone_Relbo_Rwrist.pos = Relbo.pos
   bone_Relbo_Rwrist.axis = Rwrist.pos- Relbo.pos
  

   LLeg.pos = Lank.pos RLeg.pos = Rank.pos


Related Solutions

Develop a python program to autonomously operate an adeept tank robot to pick up an object...
Develop a python program to autonomously operate an adeept tank robot to pick up an object placed randomly in an arena.
Modify the DetailedClockPane.java class in your detailed clock program, to add animation to this class. Be...
Modify the DetailedClockPane.java class in your detailed clock program, to add animation to this class. Be sure to include start() and stop() methods to start and stop the clock, respectively.Then write a program that lets the user control the clock with the start and stop buttons.
Describe how you would develop object-oriented features of Java for the Quiz program developed in the...
Describe how you would develop object-oriented features of Java for the Quiz program developed in the Programming Assignments. In particular, describe how the program could use each of the following: class variables, instance variables, inheritance, polymorphism, abstract classes, "this", "super", interfaces, and event listeners.
Describe how you would develop object-oriented features of Java for the Quiz program developed in the...
Describe how you would develop object-oriented features of Java for the Quiz program developed in the Programming Assignments. In particular, describe how the program could use each of the following: class variables, instance variables, inheritance, polymorphism, abstract classes, "this", "super", interfaces, and event listeners. Your Discussion should be at least 250 words in length, but not more than 750 words. Once you’ve completed your initial post, be sure to respond to the posts of at least 3 of your classmates.
Develop a python program that prompts the user to take up the quiz (which has choices)...
Develop a python program that prompts the user to take up the quiz (which has choices) with limited attempts and limited time. Suppose if the user answered wrong then they have to get numer of attempts(limited) Quiz should have questions on General knowldge & multiple choices for those questions
comments please Your program will calculate the distance an object travels (in meters) on Earth for...
comments please Your program will calculate the distance an object travels (in meters) on Earth for a specified number of seconds. You will also calculate the distance traveled on the Moon (in meters) for the specified number of seconds. Your program must have the main function and, at least, the following four additional functions. The signatures for these functions must be as follows: double readSeconds() double calculateEarthDistance(double seconds) double calculateMoonDistance(double seconds) void displayResults(double seconds, double earthDistance, double moonDistance) The readSeconds...
Develop a python program to ask the user to take up the quiz(General knowledge) which has...
Develop a python program to ask the user to take up the quiz(General knowledge) which has around 4 or 5 questions & choices for those questions. For each question user should have 2 or 3 attempts suppose if they are wrong. Develop the in such a manner to add few more questions and remove some questions.
4.) Create a Java program using the “extends” and “runnable” methods. You will be creating your...
4.) Create a Java program using the “extends” and “runnable” methods. You will be creating your own threaded program using the threadExtend.java code and the threadRunnable.java code. A.) Focus the threadExtend.java code DETAILS TO NOTE: - It creates 4 instances of the same thread. This means that the thread code is actually running 4 separate times - The thread accepts 2 parameters, an INTEGER from 1 to 4, as well as an ID - Note the parameters are hard coded...
You are writing a billing program that adds up the items a user enters. Your program...
You are writing a billing program that adds up the items a user enters. Your program should use a loop and prompt the user for the item number for each item in inventory to add to the bill. (You can ask the user for the number of items you will enter and use a counter controlled loop or a sentinel controlled loop that has a stop number. Either way is fine.) Here is the table of items in inventory: Item...
Power Factor Code Arduino Develop a Power factor Program in C and upload it into your...
Power Factor Code Arduino Develop a Power factor Program in C and upload it into your Arduino #include <LiquidCrystal.h> LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT