-
Notifications
You must be signed in to change notification settings - Fork 0
Implementing comm protocols #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…ng ros2sim with hym_solo
Pull Request Test Coverage Report for Build 611747165
💛 - Coveralls |
goobta
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a big one, great work! Just a handful of comments and questions.
| def get_joint_values(self, ): | ||
| """Return a dictionary containing joint values based on joint ordering | ||
| """ | ||
| pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left over?
| ## This is important to preserve the exact values of joint values. | ||
| # Converting frop degrees to radians and back to degrees can cause some floating point | ||
| # differences to exist. This essentially gets rid of them. | ||
| values = np.round(values) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't rounding cause a more significant error (floating point errors might exist, but our sensors are def not reading at that resolution)?
| if len(action_deg) != len(self.env.joint_ordering): | ||
| raise ValueError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to be suppressing this exception? In other words, should we remove the try/except so that the program just exists?
Not sure what the intended behavior is, so your call.
| except: | ||
| raise ValueError('The action needs to have the same number of joint as ' | ||
| 'the robot') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you just reraising the same exception? Then you would want to do something like the following:
try:
raise ValueError('Error1')
except:
raiseThe raise keyword will essentially reraise the exception that was caught. Re-raising the original exception allows the context of the exception to be maintained.
For example, consider the following:
try:
if err = 'error1':
raise ValueError('value1')
elif err = 'error2':
raise ValueError('value2')
else:
raiseThat way, you know exactly which error is being raised, even if they are the same error.
| for i, rad in enumerate(ground_truth_rad): | ||
| if rad > math.pi: | ||
| ground_truth_rad[i] -= (2 * math.pi) | ||
| #print(self.env_stub.step.call_args[0][0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit : leftover?
| import serial | ||
| import threading | ||
| import copy | ||
| import logging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should make this into an issue, but we should make this into a named logger for file handling and whatnot.
Actually the best bet would be to make this into an issue: I think I have a code example somewhere on how to set up the loggers properly.
| # Initial state of the state machine | ||
| self.serial_read_state = SerialReadState.INIT | ||
| # List of all possible states for the state machine | ||
| self.list_of_states = [state for state in SerialReadState] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there no function in the enum that does this? i.e. list(SerialReadState)? genuinely have no idea.
| # while True: | ||
| # request = b'' | ||
| # while not request.endswith(s.EOM.value): | ||
| # request += os.read(self.master, 1) | ||
|
|
||
| # response = self.parser.parse(request) | ||
| # os.write(self.master, response + s.EOM.value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left over?
| else: | ||
| logging.debug("Updating Joint Angles") | ||
| logging.debug("The received data is: {}".format(self.validated_packed_data)) | ||
| self.sim_executor.action(self.validated_packed_data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No response / heartbeat on the action?
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lmfao nit on the spaces
This is a working version of ros2sim that implements our communication protocols to interact with the original solo8