Files
Gym_CPU/world/__pycache__/robot.cpython-311.pyc

148 lines
8.0 KiB
Plaintext
Raw Normal View History

2026-03-10 09:31:39 -04:00
<EFBFBD>
<00><><EFBFBD>i<EFBFBD><00><00>n<00>ddlmZmZddlmZddlZddlmZGd<05>de<01><00>Z Gd<07>de <09><00>Z
dS) <09>)<02>ABC<42>abstractmethod)<01>overrideN)<01>Serverc <00><><00>eZdZdZd<02>Zeedefd<04><04><00><00><00>Zeede edffd<06><04><00><00><00>Z
dd ed
e d e d e dd f
d<0E>Z dd<0F>Z d S)<12>Robotz<74>
Base class for all robot models.
This class defines the main structure and common data used by any robot,
such as motor positions, sensors, and control messages.
c<00><><00>ddlm}||_|jj|_d<03>|jD<00><00>|_d<04>|jD<00><00>|_d<05>|jD<00><00>|_tj gd<06><01><00>|_
tj gd<06><01><00>|_ tj d<07><00>|_ tj d<07><00>|_tj d<07><00>|_dS) z<>
Creates a new robot linked to the given agent.
Args:
agent: The main agent that owns this robot.
r)<01>Agentc<00><00>i|] }|dddd<01><03><02>
S)<02><00><03>target_position<6F>kp<6B>kd<6B><00><02>.0<EFBFBD>motors <20>+/home/miku/Downloads/Code/SE/world/robot.py<70>
<dictcomp>z"Robot.__init__.<locals>.<dictcomp>s4<00><00>$
<EFBFBD>$
<EFBFBD>$
<EFBFBD><15> <12>s<EFBFBD>#<23>S<EFBFBD>A<>A<>$
<EFBFBD>$
<EFBFBD>$
<EFBFBD>c<00><00>i|]}|d<00><02>S<00>r rrs rrz"Robot.__init__.<locals>.<dictcomp>s<00><00>%P<>%P<>%P<>U<EFBFBD>e<EFBFBD>S<EFBFBD>%P<>%P<>%Prc<00><00>i|]}|d<00><02>Srrrs rrz"Robot.__init__.<locals>.<dictcomp>!s<00><00>"M<>"M<>"M<>%<25>5<EFBFBD>#<23>"M<>"M<>"Mr)rrr<00><00>N)<10>agent.base_agentr
<00>agent<6E>server<65> ROBOT_MOTORS<52> motor_targets<74>motor_positions<6E> motor_speeds<64>np<6E>array<61>_global_cheat_orientation<6F>global_orientation_quat<61>zeros<6F>global_orientation_euler<65> gyroscope<70> accelerometer)<03>selfrr
s r<00>__init__zRobot.__init__s<><00><00> +<2B>*<2A>*<2A>*<2A>*<2A>*<2A>!<21><04>
<EFBFBD>"<22>j<EFBFBD>/<2F><04> <0B>$
<EFBFBD>$
<EFBFBD><1D>*<2A>$
<EFBFBD>$
<EFBFBD>$
<EFBFBD><04><1A>
&Q<01>%P<>d<EFBFBD>>O<>%P<>%P<>%P<><04><1C>"M<>"M<>4<EFBFBD>;L<>"M<>"M<>"M<><04><19>)+<2B><18>,<2C>,<2C>,<2C>)?<3F>)?<3F><04>&<26>')<29>x<EFBFBD> <0C> <0C> <0C>'=<3D>'=<3D><04>$<24>(*<2A><08><11> <0B> <0B><04>%<25><1B><18>!<21><1B><1B><04><0E><1F>X<EFBFBD>a<EFBFBD>[<5B>[<5B><04><1A><1A>r<00>returnc<00><00>t<00><00><00>)z/
Returns the robot model name.
<20><01>NotImplementedError<6F>r,s r<00>namez
Robot.name-<00><00><00> "<22>#<23>#<23>#r.c<00><00>t<00><00><00>)zE
Returns the list of motor names used by this robot.
r0r2s rr zRobot.ROBOT_MOTORS5r4r<00>
<><E79A99><EFBFBD><EFBFBD><EFBFBD>?<3F>
motor_namerrrNc<00>"<00>|||d<01>|j|<dS)aS
Sets the desired position and PD gains for a given motor.
For now, directly sets positions, as the simulator is doing the control
Args:
motor_name: Name of the motor.
target_position: Desired position in radians.
kp: Proportional gain.
kd: Derivative gain.
r N)r!)r,r8rrrs r<00>set_motor_target_positionzRobot.set_motor_target_position=s'<00><00> /<2F><14><14>*
<EFBFBD>*
<EFBFBD><04><1A>:<3A>&<26>&<26>&rc
<00><><00>|j<00><00><00>D]C\}}d|<01>d|dd<04>d|dd<04>d|dd<04>d<08> }|j<00>|<03><00><00>Dd S)
zC
Sends all motor target commands to the simulator.
<20>(<28> rz.2fz 0.0 rrz 0.0)N)r!<00>itemsr<00>commit)r,r8<00>target_description<6F> motor_msgs r<00>commit_motor_targets_pdzRobot.commit_motor_targets_pdPs<><00><00>/3<>.@<40>.F<>.F<>.H<>.H<> *<2A> *<2A> *<2A>J<EFBFBD>*<2A>\<02>J<EFBFBD>\<02>\<02>);<3B><M<>)N<>\<02>\<02>\<02>Yk<59>lp<6C>Yq<59>\<02>\<02>\<02>yK<02>LP<02>yQ<02>\<02>\<02>\<02>\<02>I<EFBFBD> <10>K<EFBFBD> <1E> <1E>y<EFBFBD> )<29> )<29> )<29> )<29> *<2A> *r)r6r7)r.N)<0E>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__r-<00>propertyr<00>strr3<00>tupler <00>floatr:rBrrrrrs<><00><00><00><00><00><00><08><08> )<29>)<29>)<29>><0E><13>$<24>c<EFBFBD>$<24>$<24>$<24><14>^<5E><0E>X<EFBFBD>$<24> <0E><13>$<24>e<EFBFBD>C<EFBFBD><13>H<EFBFBD>o<EFBFBD>$<24>$<24>$<24><14>^<5E><0E>X<EFBFBD>$<24>TW<01>
<EFBFBD>
<EFBFBD><1D>
<EFBFBD>05<EFBFBD>
<EFBFBD>;@<40>
<EFBFBD>KP<EFBFBD>
<EFBFBD> <0A>
<EFBFBD>
<EFBFBD>
<EFBFBD>
<EFBFBD>&*<2A>*<2A>*<2A>*<2A>*<2A>*rrc<00><><00><00>eZdZdZe<04>fd<02><08><00>Zeedefd<04><04><00><00><00>Zeede edffd<06><04><00><00><00>Z
ede fd<07><04><00>Z ede eeffd<08><04><00>Z<0F>xZS) <09>T1z
Booster T1
c<00><><00><01>t<00><00><00>|<01><00>tjgd<01><01><00>|_dS)N)r r r r r r r r r r r r r r r r r r r r r r r )<05>superr-r$r%<00>joint_nominal_position)r,r<00> __class__s <20>rr-z T1.__init__]sD<00><><00> <0A><07><07><18><18><15><1F><1F><1F>&(<28>h<EFBFBD> <0E> <0E> <0E>'
<EFBFBD>'
<EFBFBD><04>#<23>#<23>#rr.c<00><00>dS)NrLrr2s rr3zT1.name}s <00><00><14>tr.c<00><00>dS)N)<17>he1<65>he2<65>lae1<65>lae2<65>lae3<65>lae4<65>rae1<65>rae2<65>rae3<65>rae4<65>te1<65>lle1<65>lle2<65>lle3<65>lle4<65>lle5<65>lle6<65>rle1<65>rle2<65>rle3<65>rle4<65>rle5<65>rle6rr2s rr zT1.ROBOT_MOTORS<52>s <00><00>
<EFBFBD>
rc<00>~<00>idd<02>dd<04>dd<06>dd<08>d d
<EFBFBD>d d <0C>d d<0E>dd<10>dd<12>dd<14>dd<16>dd<18>dd<1A>dd<1C>dd<1E>dd <20>d!d"<22>d#d$d%d&d'd(d)<29><06>S)*zK
Maps readable joint names to their simulator motor codes.
<20>Head_yawrS<00>
Head_pitchrT<00>Left_Shoulder_PitchrU<00>Left_Shoulder_RollrV<00>Left_Elbow_PitchrW<00>Left_Elbow_YawrX<00>Right_Shoulder_PitchrY<00>Right_Shoulder_RollrZ<00>Right_Elbow_Pitchr[<00>Right_Elbow_Yawr\<00>Waistr]<00>Left_Hip_Pitchr^<00> Left_Hip_Rollr_<00> Left_Hip_Yawr`<00>Left_Knee_Pitchra<00>Left_Ankle_Pitchrb<00>Left_Ankle_Rollrcrdrerfrgrhri)<06>Right_Hip_Pitch<63>Right_Hip_Roll<6C> Right_Hip_Yaw<61>Right_Knee_Pitch<63>Right_Ankle_Pitch<63>Right_Ankle_Rollrr2s r<00>MOTOR_FROM_READABLE_TO_SERVERz T1.MOTOR_FROM_READABLE_TO_SERVER<45>s<><00><00>

<EFBFBD> <16><05>
<EFBFBD> <18>%<25>
<EFBFBD> "<22>6<EFBFBD>
<EFBFBD> !<21>&<26> 
<EFBFBD>
<1F><06> 
<EFBFBD> <1D>f<EFBFBD> 
<EFBFBD> #<23>F<EFBFBD>
<EFBFBD> "<22>6<EFBFBD>
<EFBFBD> <20><16>
<EFBFBD> <1E>v<EFBFBD>
<EFBFBD> <14>U<EFBFBD>
<EFBFBD> <1D>f<EFBFBD>
<EFBFBD> <1C>V<EFBFBD>
<EFBFBD> <1B>F<EFBFBD>
<EFBFBD> <1E>v<EFBFBD>
<EFBFBD> <1F><06>!
<EFBFBD>" <1E>v<EFBFBD>#
<EFBFBD>$ &<26>$<24>#<23> &<26>!'<27> &<26>/
<EFBFBD>
<EFBFBD>
<EFBFBD>
rc<00>"<00>ddddddddd d
d d d d<0E> S)z<>
Defines pairs of symmetric motors and whether their direction is inverted.
Returns:
A dictionary where each key is a logical joint group name,
and the value is a tuple (motor_names, inverted).
))rkF))rlF))rmrqF))rnrrT))rorsF))rprtT))ruF))rvr|F))rwr}T))rxr~T))ryrF))rzr<>F))r{r<>T) rkrl<00>Shoulder_Pitch<63> Shoulder_Roll<6C> Elbow_Pitch<63> Elbow_Yawru<00> Hip_Pitch<63>Hip_Roll<6C>Hip_Yaw<61>
Knee_Pitch<EFBFBD> Ankle_Pitch<63>
Ankle_Rollrr2s r<00>MOTOR_SYMMETRYzT1.MOTOR_SYMMETRY<52>sT<00><00>/<2F>2<><0E><0E><0E><0E>)<29><0E><0E><0E><0E><0E><0E>GJ
<EFBFBD>J
<EFBFBD>J
r)rCrDrErFrr-rGrHr3rIr <00>dictr<74><00>list<73>boolr<6C><00> __classcell__)rPs@rrLrLYs<00><><00><00><00><00><00><08><08><0E>
<EFBFBD>
<EFBFBD>
<EFBFBD>
<EFBFBD><0E>X<EFBFBD>
<EFBFBD>><0E> <0A><14>c<EFBFBD><14><14><14><0E>X<EFBFBD><0E>X<EFBFBD><14><0E> <0A>
<EFBFBD>e<EFBFBD>C<EFBFBD><13>H<EFBFBD>o<EFBFBD>
<EFBFBD>
<EFBFBD>
<EFBFBD><0E>X<EFBFBD><0E>X<EFBFBD>
<EFBFBD>6<0E>
<EFBFBD>t<EFBFBD>
<EFBFBD>
<EFBFBD>
<EFBFBD><0E>X<EFBFBD>
<EFBFBD><<0E>R
<EFBFBD><04>S<EFBFBD>$<24>Y<EFBFBD><0F>R
<EFBFBD>R
<EFBFBD>R
<EFBFBD><0E>X<EFBFBD>R
<EFBFBD>R
<EFBFBD>R
<EFBFBD>R
<EFBFBD>R
rrL) <0B>abcrr<00>typing_extensionsr<00>numpyr$<00>communication.serverrrrLrrr<00><module>r<>s<><00><01>#<23>#<23>#<23>#<23>#<23>#<23>#<23>#<23>&<26>&<26>&<26>&<26>&<26>&<26><12><12><12><12>'<27>'<27>'<27>'<27>'<27>'<27>O*<2A>O*<2A>O*<2A>O*<2A>O*<2A>C<EFBFBD>O*<2A>O*<2A>O*<2A>dx
<EFBFBD>x
<EFBFBD>x
<EFBFBD>x
<EFBFBD>x
<EFBFBD><15>x
<EFBFBD>x
<EFBFBD>x
<EFBFBD>x
<EFBFBD>x
r