SVHSerialPacket.h
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 // This file is part of the SCHUNK SVH Driver suite.
5 //
6 // This program is free software licensed under the LGPL
7 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
8 // You can find a copy of this license in LICENSE folder in the top
9 // directory of the source code.
10 //
11 // © Copyright 2014 SCHUNK Mobile Greifsysteme GmbH, Lauffen/Neckar Germany
12 // © Copyright 2014 FZI Forschungszentrum Informatik, Karlsruhe, Germany
13 //
14 // -- END LICENSE BLOCK ------------------------------------------------
15 
16 //----------------------------------------------------------------------
28 //----------------------------------------------------------------------
29 #ifndef SVHSERIALPACKET_H
30 #define SVHSERIALPACKET_H
31 
32 #include <icl_comm/ByteOrderConversion.h>
33 
34 namespace driver_svh {
35 
36 //===============
37 // Some constants
38 //===============
39 
40 // packet sizes
41 const size_t cPACKET_APPENDIX_SIZE = 8;
42 const size_t cDEFAULT_PACKET_SIZE = 48;
43 
44 // packet headers
45 const uint8_t PACKET_HEADER1 = 0x4C;
46 const uint8_t PACKET_HEADER2 = 0xAA;
47 
48 // adress constants for commands
62 
67 {
74  std::vector <uint8_t> data;
75 
80  SVHSerialPacket(size_t _data_length=0,uint8_t _address = SVH_GET_CONTROL_FEEDBACK):
81  address(_address),
82  data(_data_length,0)
83  {
84  }
85 
87  bool operator == (const SVHSerialPacket& other) const
88  {
89  return
90  (index == other.index
91  && address == other.address
92  && data == other.data);
93  }
94 };
95 
97 icl_comm::ArrayBuilder& operator << (icl_comm::ArrayBuilder& ab, const SVHSerialPacket& data);
98 
100 icl_comm::ArrayBuilder& operator >> (icl_comm::ArrayBuilder& ab, SVHSerialPacket& data);
101 
103 std::ostream& operator << (std::ostream& o, const SVHSerialPacket& sp);
104 
105 }
106 #endif // SVHSERIALPACKET_H
const uint8_t PACKET_HEADER1
Header sync byte 1.
const uint8_t SVH_GET_POSITION_SETTINGS
Requests the active settings of the position controller.
const uint8_t PACKET_HEADER2
Header sync byte 2.
SVHSerialPacket(size_t _data_length=0, uint8_t _address=SVH_GET_CONTROL_FEEDBACK)
SVHSerialPacket contains the send and received data in raw format (bytewise)
const uint8_t SVH_GET_CONTROL_FEEDBACK
Request the position and current of a channel to be sent.
const uint8_t SVH_SET_CONTROL_COMMAND
Sets the target position of a channel.
const uint8_t SVH_SET_ENCODER_VALUES
Set new encoder scalings.
uint8_t address
Adress denotes the actual function of the package.
const uint8_t SVH_GET_CONTROLLER_STATE
Requests the state of the controller (active,faults,enabled channels)
icl_comm::ArrayBuilder & operator>>(icl_comm::ArrayBuilder &ab, SVHControlCommand &data)
overload stream operator to easily deserialize control commands for one channel
std::vector< uint8_t > data
Payload of the package.
unsigned char uint8_t
const uint8_t SVH_SET_CONTROLLER_STATE
Sets new controller states (enable channels, clear faults)
const size_t cPACKET_APPENDIX_SIZE
The packet overhead size in bytes.
const uint8_t SVH_GET_ENCODER_VALUES
Request the current encoder scalings.
const uint8_t SVH_SET_CURRENT_SETTINGS
Sets new settings for the current controller.
icl_comm::ArrayBuilder & operator<<(icl_comm::ArrayBuilder &ab, const SVHControlCommand &data)
uint8_t index
Continuosly incremented counter per package.
const uint8_t SVH_SET_POSITION_SETTINGS
Sets new settings for the position controller.
const uint8_t SVH_GET_CURRENT_SETTINGS
Requests the active settings of the current controller.
const uint8_t SVH_GET_CONTROL_FEEDBACK_ALL
Requests the positions and currents of ALL channels.
const uint8_t SVH_SET_CONTROL_COMMAND_ALL
Sends the target position to ALL the channels.
bool operator==(const SVHSerialPacket &other) const
Compares two SVHSerialPackets objects.
const uint8_t SVH_GET_FIRMWARE_INFO
Request the firmware info to be transmitted.
const size_t cDEFAULT_PACKET_SIZE
Default packet payload size in bytes.
The SerialPacket holds the (non generated) header and data of one message to the SVH-Hardware.


schunk_svh_driver
Author(s): Georg Heppner
autogenerated on Mon Jun 10 2019 15:04:59